Skip to content

Commit

Permalink
Merge pull request #89 from phillmv/add-build-provenance
Browse files Browse the repository at this point in the history
Add build provenance
  • Loading branch information
phillmv authored Jan 2, 2024
2 parents 5dcee73 + d8e7b06 commit 67e2d51
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/publish_container.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,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
name: Create and publish a Docker image

permissions:
id-token: write
contents: write
packages: write

# Configures this workflow to run every time a change is pushed to the branch called `release`.
on:
push:
Expand Down Expand Up @@ -59,6 +64,7 @@ jobs:
# 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.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
id: build-push-latest
uses: docker/build-push-action@v5
with:
context: .
Expand All @@ -68,6 +74,11 @@ jobs:
annotations: ${{ steps.meta.outputs.annotations }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Attest image
uses: github-early-access/generate-build-provenance@main
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.build-push-latest.outputs.digest }}
- name: Extract metadata (tags, labels) for dev image
id: meta2
uses: docker/metadata-action@v5
Expand All @@ -79,6 +90,7 @@ jobs:
type=ref,event=branch
type=sha,format=long
- name: Build and push dev image
id: build-push-development
uses: docker/build-push-action@v5
with:
context: .
Expand All @@ -87,6 +99,10 @@ jobs:
tags: ${{ steps.meta2.outputs.tags }}
labels: ${{ steps.meta2.outputs.labels }}
annotations: ${{ steps.meta2.outputs.annotations }}

cache-from: type=gha
cache-to: type=gha,mode=max
- name: Attest dev image
uses: github-early-access/generate-build-provenance@main
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-development
subject-digest: ${{ steps.build-push-development.outputs.digest }}

0 comments on commit 67e2d51

Please sign in to comment.