feat(Pipeline): use github actions
This commit is contained in:
parent
82c66f19e4
commit
4a02fd1e78
1 changed files with 22 additions and 22 deletions
|
@ -2,28 +2,28 @@ name: Build the Docker Image
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
runs-on: docker
|
||||
container:
|
||||
image: docker:dind
|
||||
|
||||
docker:
|
||||
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
|
||||
-
|
||||
name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ vars.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
-
|
||||
name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
push: true
|
||||
tags:
|
||||
- ${{ vars.DOCKER_USERNAME }}/blog:latest
|
||||
- ${{ vars.DOCKER_USERNAME }}/blog:${{ gitea.sha }}
|
Loading…
Add table
Add a link
Reference in a new issue