Skip to content

Commit e7d2b54

Browse files
authored
chore(ci): improve container tagging (#1639)
1 parent a5e6d6f commit e7d2b54

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions:
99
packages: write
1010

1111
concurrency:
12-
cancel-in-progress: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
12+
cancel-in-progress: ${{ github.ref_type == 'branch' }}
1313
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
1414

1515
jobs:
@@ -230,6 +230,9 @@ jobs:
230230
id-token: write
231231
env:
232232
RELEASE_NIGHTLY: ${{ startsWith(github.ref, 'refs/tags/nightly-') }}
233+
RELEASE_LATEST: ${{ startsWith(github.ref, 'refs/tags/v') }}
234+
RELEASE_CANARY: ${{ github.ref == 'refs/heads/main' }}
235+
RELEASE_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || github.sha }}
233236

234237
strategy:
235238
matrix:
@@ -278,7 +281,8 @@ jobs:
278281
with:
279282
images: ghcr.io/edgeandnode/${{ matrix.name }}
280283
tags: |
281-
type=raw,value=latest,enable=${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
284+
type=raw,value=canary,enable=${{ env.RELEASE_CANARY == 'true' }}
285+
type=raw,value=latest,enable=${{ env.RELEASE_LATEST == 'true' }}
282286
type=raw,value=nightly,enable=${{ env.RELEASE_NIGHTLY == 'true' }}
283287
type=ref,event=tag
284288
type=sha
@@ -290,7 +294,7 @@ jobs:
290294
org.opencontainers.image.description=${{ matrix.description }}
291295
org.opencontainers.image.created=${{ steps.timestamp.outputs.timestamp }}
292296
org.opencontainers.image.revision=${{ github.sha }}
293-
org.opencontainers.image.version=${{ github.ref_type == 'tag' && github.ref_name || github.sha }}
297+
org.opencontainers.image.version=${{ env.RELEASE_VERSION }}
294298
annotations: |
295299
manifest:org.opencontainers.image.source=https://github.com/edgeandnode/amp
296300
manifest:org.opencontainers.image.url=https://github.com/edgeandnode/amp

0 commit comments

Comments
 (0)