From d4bba88fb14133e99ed517f27f3566a006ebe628 Mon Sep 17 00:00:00 2001 From: Rehan Mahmood Date: Thu, 25 Jan 2024 10:02:01 -0500 Subject: [PATCH] Update and fix the docker image deplyment build --- .github/workflows/deploy.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 55e7978..2786795 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -6,8 +6,13 @@ name: CD on: # Triggers the workflow on push or pull request events but only for the main branch push: - branches: [ main ] + branches: + - '*' + tags: + - 'v*' pull_request: + branches: + - '*' # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -19,32 +24,37 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Docker meta id: docker_meta - uses: crazy-max/ghaction-docker-meta@v1 + uses: docker/metadata-action@v4 with: images: schollz/croc - # tag-semver: "{{version}}" - tag-sha: true - tag-latest: true + # generate Docker tags based on the following events/attributes + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to DockerHub if: github.event_name != 'pull_request' - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: context: . file: ./Dockerfile