Skip to content

Commit

Permalink
Merge pull request #227 from GeoWerkstatt/attestations-fix
Browse files Browse the repository at this point in the history
Fix permissions and generate attestations
  • Loading branch information
danjov authored Nov 8, 2024
2 parents 2872265 + ef45d92 commit af970be
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 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 All @@ -26,6 +31,9 @@ jobs:
echo COMMITED_AT=$(git show -s --format=%cI `git rev-parse HEAD`) >> $GITHUB_ENV
echo REVISION=$(git rev-parse --short HEAD) >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Collect Docker image metadata
id: meta
uses: docker/metadata-action@v5
Expand All @@ -49,6 +57,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 +70,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 af970be

Please sign in to comment.