Skip to content

Commit 8fb33f1

Browse files
cursoragentkubo6472
andcommitted
ci: tag main builds as latest + incrementing build number
On push to main, publish latest and build-<run_number> tags. On version tag pushes, publish only the release tag (e.g. v1.2.3). Co-authored-by: Jakub Doboš <kubo6472@users.noreply.github.com>
1 parent 1ec25fe commit 8fb33f1

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

.github/workflows/release-docker.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,16 @@ jobs:
116116
images: |
117117
ghcr.io/${{ env.REPO }}-server-core
118118
tags: |
119-
type=ref,event=branch
119+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
120+
type=raw,value=build-${{ github.run_number }},enable=${{ github.ref == 'refs/heads/main' }}
120121
type=ref,event=tag
121-
type=raw,value=latest,enable={{is_default_branch}}
122+
123+
- name: Note main build tags
124+
if: github.ref == 'refs/heads/main'
125+
run: |
126+
echo "**Main build published**" >> "$GITHUB_STEP_SUMMARY"
127+
echo "- \`ghcr.io/${{ env.REPO }}-server-core:latest\`" >> "$GITHUB_STEP_SUMMARY"
128+
echo "- \`ghcr.io/${{ env.REPO }}-server-core:build-${{ github.run_number }}\`" >> "$GITHUB_STEP_SUMMARY"
122129
123130
- name: Log in to GitHub Container Registry
124131
if: steps.ghcr-tag.outputs.tags != ''
@@ -188,9 +195,9 @@ jobs:
188195
images: |
189196
ghcr.io/${{ env.REPO }}-${{ matrix.gateway-name }}
190197
tags: |
191-
type=ref,event=branch
198+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
199+
type=raw,value=build-${{ github.run_number }},enable=${{ github.ref == 'refs/heads/main' }}
192200
type=ref,event=tag
193-
type=raw,value=latest,enable={{is_default_branch}}
194201
195202
- name: Log in to GitHub Container Registry
196203
if: steps.ghcr-tag.outputs.tags != ''
@@ -243,3 +250,5 @@ jobs:
243250
docker pull ghcr.io/${{ env.REPO }}-mos-gateway:${{ github.ref_name }}
244251
docker pull ghcr.io/${{ env.REPO }}-live-status-gateway:${{ github.ref_name }}
245252
```
253+
254+
`latest` continues to track the most recent `main` build.

0 commit comments

Comments
 (0)