Skip to content

Commit 378ea78

Browse files
committed
Update workflow to publish image for separate branches.
1 parent ec9e6c9 commit 378ea78

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/docker-publish.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: Build and Push Docker image to GHCR
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- '**'
67
workflow_dispatch:
78

89
jobs:
@@ -30,10 +31,19 @@ jobs:
3031
username: ${{ github.actor }}
3132
password: ${{ secrets.GITHUB_TOKEN }}
3233

34+
- name: Set tag name
35+
id: set_tag
36+
run: |
37+
if [[ "${{ github.ref_name }}" == "main" ]]; then
38+
echo "TAG=pre-alpha" >> $GITHUB_OUTPUT
39+
else
40+
echo "TAG=${{ github.ref_name }}" >> $GITHUB_OUTPUT
41+
fi
42+
3343
- name: Build and push Docker image (amd64 + arm64)
3444
uses: docker/build-push-action@v5
3545
with:
3646
context: .
3747
push: true
3848
platforms: linux/amd64,linux/arm64
39-
tags: ghcr.io/${{ github.repository }}:pre-alpha
49+
tags: ghcr.io/${{ github.repository }}:${{ steps.set_tag.outputs.TAG }}

0 commit comments

Comments
 (0)