27 lines
No EOL
746 B
YAML
27 lines
No EOL
746 B
YAML
name: Build the Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Log in to Docker Hub
|
|
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
|
|
|
- name: Generate timestamp
|
|
run: echo "TIMESTAMP=$(date +%s)" >> $GITHUB_ENV
|
|
|
|
- name: Build the Docker image
|
|
run: docker build . --file Dockerfile --tag "${{ secrets.DOCKER_USERNAME }}"/jekyll-blog:${TIMESTAMP} --tag "${{ secrets.DOCKER_USERNAME }}"/jekyll-blog:latest
|
|
|
|
- name: Push the Docker image
|
|
run: docker push -a "${{ secrets.DOCKER_USERNAME }}"/jekyll-blog |