Skip to content

Commit

Permalink
ci(github): try to fix tag names
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvitt committed Oct 29, 2024
1 parent 49c20f9 commit 6320356
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Build and Push Docker Image

on:
push:
branches:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6320356

Please sign in to comment.