Skip to content

Commit 81a8e39

Browse files
authored
ci: fix docker (#67)
1 parent 122ad81 commit 81a8e39

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

.github/workflows/docker.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,25 @@ jobs:
3636
password: ${{ secrets.GITHUB_TOKEN }} # works if org allows Actions to publish packages
3737

3838
- name: Set IMAGE env
39-
run: echo "IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}/yaci" >> "$GITHUB_ENV"
39+
run: echo "IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/yaci" >> "$GITHUB_ENV"
40+
41+
- name: Extract metadata (tags, labels) for Docker
42+
id: meta
43+
uses: docker/metadata-action@v5
44+
with:
45+
images: ${{ env.IMAGE }}
46+
tags: |
47+
type=raw,value=latest
48+
type=sha,format=long # equals ${{ github.sha }}
4049
4150
- name: Build & Push
4251
id: docker_build
4352
uses: docker/build-push-action@v6
4453
with:
4554
context: .
4655
push: true
47-
tags: |
48-
${{ env.IMAGE }}:latest
49-
${{ env.IMAGE }}:${{ github.sha }}
56+
tags: ${{ steps.meta.outputs.tags }}
57+
labels: ${{ steps.meta.outputs.labels }}
5058
cache-from: type=gha
5159
cache-to: type=gha,mode=max
5260
provenance: mode=max
@@ -59,6 +67,6 @@ jobs:
5967
- name: Generate artifact attestation
6068
uses: actions/attest-build-provenance@v2
6169
with:
62-
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
70+
subject-name: ${{ env.IMAGE }}
6371
subject-digest: ${{ steps.docker_build.outputs.digest }}
6472
push-to-registry: true # publish as an OCI referrer alongside the image

0 commit comments

Comments
 (0)