Skip to content

Commit c9828c1

Browse files
committed
better labels for containers
1 parent c52ba2c commit c9828c1

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/docker.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ jobs:
1515
permissions:
1616
contents: read
1717
packages: write
18+
19+
strategy:
20+
matrix:
21+
platform:
22+
- linux/amd64
23+
- linux/arm64
1824

1925
steps:
2026
- name: Checkout repository
@@ -30,20 +36,27 @@ jobs:
3036
username: ${{ github.actor }}
3137
password: ${{ secrets.GITHUB_TOKEN }}
3238

39+
- name: Extract platform suffix
40+
id: platform
41+
run: |
42+
platform_pair=${{ matrix.platform }}
43+
platform_suffix=${platform_pair#*/}
44+
echo "suffix=${platform_suffix}" >> $GITHUB_OUTPUT
45+
3346
- name: Extract metadata
3447
id: meta
3548
uses: docker/metadata-action@v5
3649
with:
3750
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3851
tags: |
39-
type=sha,format=short
40-
type=raw,value=latest,enable={{is_default_branch}}
52+
type=sha,format=short,suffix=-${{ steps.platform.outputs.suffix }}
53+
type=raw,value=latest-${{ steps.platform.outputs.suffix }},enable={{is_default_branch}}
4154
4255
- name: Build and push Docker image
4356
uses: docker/build-push-action@v5
4457
with:
4558
context: .
46-
platforms: linux/amd64,linux/arm64
59+
platforms: ${{ matrix.platform }}
4760
push: true
4861
tags: ${{ steps.meta.outputs.tags }}
4962
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)