From 63203561b12d84f5d44e5689c69b78a58b1f105c Mon Sep 17 00:00:00 2001 From: Ruben Vitt Date: Tue, 29 Oct 2024 21:20:48 +0100 Subject: [PATCH] ci(github): try to fix tag names --- .github/workflows/backend.yml | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index f930316..e4b0ea8 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -1,3 +1,5 @@ +name: Build and Push Docker Image + on: push: branches: @@ -34,29 +36,17 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Set tags for main branch - if: github.ref == 'refs/heads/main' - run: echo "TAGS=latest,main,main:${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - - - name: Set tags for alpha branch - if: github.ref == 'refs/heads/alpha' - run: echo "TAGS=alpha,alpha:${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - - - name: Set tags for beta branch - if: github.ref == 'refs/heads/beta' - run: echo "TAGS=beta,beta:${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - - - name: Set tags for develop branch - if: github.ref == 'refs/heads/develop' - run: echo "TAGS=develop,develop:${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v4 + if: startsWith(github.ref, 'refs/heads/') with: - sep-tags: , images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: ${{ env.TAGS }} + tags: | + type=ref,event=branch + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + type=raw,value={{branch}} + type=raw,value={{branch}}-{{sha}} - name: Build and push Docker image uses: docker/build-push-action@v4