Skip to content

Commit

Permalink
Fix permissions and generate attestation
Browse files Browse the repository at this point in the history
  • Loading branch information
danjov committed Nov 8, 2024
1 parent 2872265 commit 077741c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
create-pre-release:
runs-on: ubuntu-latest
name: Build and push Docker image and create a new GitHub pre-release
permissions:
id-token: write
contents: read
attestations: write
packages: write

steps:
- name: Checkout repository
Expand Down Expand Up @@ -49,6 +54,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
context: .
Expand All @@ -61,6 +67,21 @@ jobs:
sbom: true
provenance: mode=max

- name: Generate docker image attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

- name: Generate SBOM attestation
uses: actions/attest-sbom@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
sbom-path: 'sbom.json'
push-to-registry: true

- name: Create GitHub pre-release
run: |
gh api \
Expand Down

0 comments on commit 077741c

Please sign in to comment.