Skip to content

Commit d8e7b06

Browse files
authored
Add build provenance
1 parent 5dcee73 commit d8e7b06

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.github/workflows/publish_container.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio
22
name: Create and publish a Docker image
33

4+
permissions:
5+
id-token: write
6+
contents: write
7+
packages: write
8+
49
# Configures this workflow to run every time a change is pushed to the branch called `release`.
510
on:
611
push:
@@ -59,6 +64,7 @@ jobs:
5964
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
6065
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
6166
- name: Build and push Docker image
67+
id: build-push-latest
6268
uses: docker/build-push-action@v5
6369
with:
6470
context: .
@@ -68,6 +74,11 @@ jobs:
6874
annotations: ${{ steps.meta.outputs.annotations }}
6975
cache-from: type=gha
7076
cache-to: type=gha,mode=max
77+
- name: Attest image
78+
uses: github-early-access/generate-build-provenance@main
79+
with:
80+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
81+
subject-digest: ${{ steps.build-push-latest.outputs.digest }}
7182
- name: Extract metadata (tags, labels) for dev image
7283
id: meta2
7384
uses: docker/metadata-action@v5
@@ -79,6 +90,7 @@ jobs:
7990
type=ref,event=branch
8091
type=sha,format=long
8192
- name: Build and push dev image
93+
id: build-push-development
8294
uses: docker/build-push-action@v5
8395
with:
8496
context: .
@@ -87,6 +99,10 @@ jobs:
8799
tags: ${{ steps.meta2.outputs.tags }}
88100
labels: ${{ steps.meta2.outputs.labels }}
89101
annotations: ${{ steps.meta2.outputs.annotations }}
90-
91102
cache-from: type=gha
92103
cache-to: type=gha,mode=max
104+
- name: Attest dev image
105+
uses: github-early-access/generate-build-provenance@main
106+
with:
107+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-development
108+
subject-digest: ${{ steps.build-push-development.outputs.digest }}

0 commit comments

Comments
 (0)