|
11 | 11 | id-token: write # Needed if using OIDC to get release secrets. |
12 | 12 | contents: write # Contents and pull-requests are for release-please to make releases. |
13 | 13 | pull-requests: write |
| 14 | + attestations: write # Needed for artifact attestations |
14 | 15 | outputs: |
15 | 16 | release-created: ${{ steps.release.outputs.release_created }} |
16 | 17 | upload-tag-name: ${{ steps.release.outputs.tag_name }} |
|
22 | 23 | - uses: actions/checkout@v4 |
23 | 24 | if: ${{ steps.release.outputs.releases_created == 'true' }} |
24 | 25 | with: |
25 | | - fetch-depth: 0 # Full history is required for proper changelog generation |
| 26 | + fetch-depth: 0 |
| 27 | + |
| 28 | + - name: Create release tag |
| 29 | + if: ${{ steps.release.outputs.releases_created == 'true' }} |
| 30 | + env: |
| 31 | + TAG_NAME: ${{ steps.release.outputs.tag_name }} |
| 32 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + run: | |
| 34 | + if gh api "repos/${{ github.repository }}/git/ref/tags/${TAG_NAME}" >/dev/null 2>&1; then |
| 35 | + echo "Tag ${TAG_NAME} already exists, skipping creation." |
| 36 | + else |
| 37 | + echo "Creating tag ${TAG_NAME}." |
| 38 | + git config user.name "github-actions[bot]" |
| 39 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 40 | + git tag "${TAG_NAME}" |
| 41 | + git push origin "${TAG_NAME}" |
| 42 | + fi |
26 | 43 |
|
27 | 44 | - uses: actions/setup-python@v5 |
28 | 45 | if: ${{ steps.release.outputs.releases_created == 'true' }} |
@@ -53,15 +70,31 @@ jobs: |
53 | 70 | with: |
54 | 71 | password: ${{env.PYPI_AUTH_TOKEN}} |
55 | 72 |
|
56 | | - release-provenance: |
57 | | - needs: ["release-package"] |
| 73 | + - name: Generate checksums file |
| 74 | + if: ${{ steps.release.outputs.releases_created == 'true' }} |
| 75 | + env: |
| 76 | + HASHES: ${{ steps.build.outputs.package-hashes }} |
| 77 | + run: | |
| 78 | + echo "$HASHES" | base64 -d > checksums.txt |
| 79 | +
|
| 80 | + - name: Attest build provenance |
| 81 | + if: ${{ steps.release.outputs.releases_created == 'true' }} |
| 82 | + uses: actions/attest@v4 |
| 83 | + with: |
| 84 | + subject-checksums: checksums.txt |
| 85 | + |
| 86 | + publish-release: |
| 87 | + needs: ['release-package'] |
58 | 88 | if: ${{ needs.release-package.outputs.release-created == 'true' }} |
| 89 | + runs-on: ubuntu-latest |
59 | 90 | permissions: |
60 | | - actions: read |
61 | | - id-token: write |
62 | 91 | contents: write |
63 | | - uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@5a775b367a56d5bd118a224a811bba288150a563 # v2.0.0 |
64 | | - with: |
65 | | - base64-subjects: "${{ needs.release-package.outputs.package-hashes }}" |
66 | | - upload-assets: true |
67 | | - upload-tag-name: ${{ needs.release-package.outputs.upload-tag-name }} |
| 92 | + steps: |
| 93 | + - name: Publish release |
| 94 | + env: |
| 95 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 96 | + TAG_NAME: ${{ needs.release-package.outputs.upload-tag-name }} |
| 97 | + run: > |
| 98 | + gh release edit "$TAG_NAME" |
| 99 | + --repo ${{ github.repository }} |
| 100 | + --draft=false |
0 commit comments