|
6 | 6 | - v1
|
7 | 7 | workflow_dispatch:
|
8 | 8 |
|
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
9 | 12 | jobs:
|
10 | 13 | release:
|
11 | 14 | name: Release
|
|
16 | 19 | id-token: write
|
17 | 20 | attestations: write
|
18 | 21 | steps:
|
| 22 | + - name: Harden the runner (Audit all outbound calls) |
| 23 | + uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2 |
| 24 | + with: |
| 25 | + egress-policy: audit |
| 26 | + |
19 | 27 | - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
20 | 28 | with:
|
21 | 29 | node-version: 22
|
|
26 | 34 | working-directory: lambdas
|
27 | 35 | run: yarn install --frozen-lockfile && yarn run test && yarn dist
|
28 | 36 | - name: Get installation token
|
29 |
| - uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2 |
| 37 | + uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 |
30 | 38 | id: token
|
31 | 39 | with:
|
32 | 40 | app-id: ${{ vars.RELEASER_APP_ID }}
|
|
45 | 53 | - name: Attest
|
46 | 54 | if: ${{ steps.release.outputs.releases_created == 'true' }}
|
47 | 55 | id: attest
|
48 |
| - uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3 |
| 56 | + uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0 |
49 | 57 | with:
|
50 | 58 | subject-path: '${{ github.workspace }}/lambdas/functions/**/*.zip'
|
51 | 59 | - name: Update release notes with attestation
|
|
62 | 70 | gh release view $version --json body -q '.body' > new-release-notes.md
|
63 | 71 | echo "## Attestation" >> new-release-notes.md
|
64 | 72 | echo "Attestation url: $attestation_url" >> new-release-notes.md
|
65 |
| - echo "Verify the artifacts by running \`gh attest verify <name_of_artifact> --repo ${{ github.repository }}\`" >> new-release-notes.md |
| 73 | + echo "Verify the artifacts by running \`gh attestation verify <name_of_artifact> --repo ${{ github.repository }}\`" >> new-release-notes.md |
66 | 74 | gh release edit $tag_name -F new-release-notes.md -t $tag_name
|
67 | 75 | - name: Upload release assets
|
68 | 76 | if: ${{ steps.release.outputs.releases_created == 'true' }}
|
|
74 | 82 | for f in $(find . -name '*.zip'); do
|
75 | 83 | gh release upload $tag_name $f
|
76 | 84 | done
|
| 85 | + - name: Attach attestation |
| 86 | + if: ${{ steps.release.outputs.releases_created == 'true' }} |
| 87 | + env: |
| 88 | + ATTESTATION_BUNDLE: ${{ steps.attest.outputs.bundle-path }} |
| 89 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + TAG_NAME: ${{ steps.release.outputs.tag_name }} |
| 91 | + ATTESTATION_ID: ${{ steps.attest.outputs.attestation-id }} |
| 92 | + run: | |
| 93 | + # rename attest bundle to github-aws-runners-terraform-aws-github-runner-attestation-$attestation-id.sigstore |
| 94 | + # OpenSSF expects the attestation bundle to be named in this format (*.sigstore) |
| 95 | + SIGSTORE_BUNDLE=$RUNNER_TEMP/github-aws-runners-terraform-aws-github-runner-attestation-${ATTESTATION_ID}.sigstore |
| 96 | + INTOTO_BUNDLE=$RUNNER_TEMP/github-aws-runners-terraform-aws-github-runner-attestation-${ATTESTATION_ID}.intoto.jsonl |
| 97 | + mv ${ATTESTATION_BUNDLE} $SIGSTORE_BUNDLE |
| 98 | + if [ -z "$SIGSTORE_BUNDLE" ]; then |
| 99 | + echo "No attestation bundle found, skipping attachment." |
| 100 | + exit 0 |
| 101 | + fi |
| 102 | + gh release upload $TAG_NAME "$SIGSTORE_BUNDLE" |
| 103 | + cat ${SIGSTORE_BUNDLE} | jq -r '.dsseEnvelope | select(.payloadType == "application/vnd.in-toto+json").payload' | base64 -d | jq .> ${INTOTO_BUNDLE} |
| 104 | + gh release upload $TAG_NAME "${INTOTO_BUNDLE}" |
0 commit comments