@@ -75,23 +75,13 @@ jobs:
7575 permissions :
7676 contents : read
7777
78- # Generate the build provenance. The generator should be referenced with a semantic version.
79- # The build will fail if we reference it using the commit SHA.
80- provenance :
81- needs : build
82- uses : slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.2.0
83- with :
84- base64-subjects : ${{ needs.build.outputs.artifacts-sha256 }}
85- permissions :
86- actions : read # To read the workflow path.
87- id-token : write # To sign the provenance.
88- contents : write # To add assets to a release.
89-
9078 # Create a new Release on Github from the verified build artifacts, and optionally
9179 # publish the artifacts to a PyPI server.
9280 release :
93- needs : [build, provenance ]
81+ needs : [build]
9482 name : Release
83+ outputs :
84+ release-tag : ${{ steps.upload-assets.outputs.release-tag }}
9585 runs-on : ubuntu-latest
9686 permissions :
9787 contents : write # To publish release notes.
@@ -107,11 +97,6 @@ jobs:
10797 with :
10898 fetch-depth : 0
10999
110- - name : Download provenance
111- uses : actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # v3.0.0
112- with :
113- name : ${{ needs.provenance.outputs.attestation-name }}
114-
115100 - name : Download artifact
116101 uses : actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # v3.0.0
117102 with :
@@ -133,18 +118,24 @@ jobs:
133118 uses : actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # v4.2.0
134119 with :
135120 python-version : ' 3.10'
121+
136122 - name : Set up Commitizen
137123 run : |
138124 pip install --upgrade pip wheel
139125 pip install 'commitizen ==2.32.1'
126+
140127 - name : Create Release Notes
141128 run : cz changelog --dry-run $(cz version --project) > RELEASE_NOTES.md
142129
143130 # Create the release including the artifacts and the SLSA L3 provenance.
144131 - name : Upload assets
132+ id : upload-assets
145133 env :
146134 GH_TOKEN : ${{ secrets.REPO_ACCESS_TOKEN }}
147- run : TAG=`git describe --tags --abbrev=0` && gh release create $TAG dist/* ${{ needs.provenance.outputs.attestation-name }} --title $TAG --notes-file RELEASE_NOTES.md
135+ run : |
136+ TAG=`git describe --tags --abbrev=0`
137+ gh release create $TAG dist/* --title $TAG --notes-file RELEASE_NOTES.md
138+ echo "release-tag=$TAG" >> $GITHUB_OUTPUT
148139
149140 # Uncomment the following steps to publish to a PyPI server.
150141 # At the moment PyPI does not provide a mechanism to publish
@@ -166,3 +157,51 @@ jobs:
166157 # TWINE_USERNAME=<USERNAME>
167158 # TWINE_PASSWORD=<PASSWORD>
168159 # TWINE_REPOSITORY_URL=<REPOSITORY_URL>
160+
161+ # Generate the build provenance. The generator should be referenced with a semantic version.
162+ # The build will fail if we reference it using the commit SHA. To avoid using a pre-built
163+ # provenance generator which depends on an external service Rekor (https://github.com/sigstore/rekor)
164+ # we build this generator from source for now. For more information see this discussion:
165+ # https://github.com/slsa-framework/slsa-github-generator/issues/942
166+ provenance :
167+ needs : [build, release]
168+ uses : slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.2.1
169+ with :
170+ base64-subjects : ${{ needs.build.outputs.artifacts-sha256 }}
171+ compile-generator : true # Build the generator from source.
172+ # Set private-repository to true for private repositories. Note that the repository name is
173+ # uploaded as part of the transparency log entry on the public Rekor instance (rekor.sigstore.dev).
174+ private-repository : false
175+ permissions :
176+ actions : read # To read the workflow path.
177+ id-token : write # To sign the provenance.
178+ contents : write # To add assets to a release.
179+
180+ # Publish the SLSA provenance as the GitHub release asset.
181+ publish_provenance :
182+ needs : [release, provenance]
183+ name : Publish provenance
184+ runs-on : ubuntu-latest
185+ permissions :
186+ contents : write # To publish release notes.
187+ steps :
188+
189+ - name : Harden Runner
190+ uses : step-security/harden-runner@2e205a28d0e1da00c5f53b161f4067b052c61f34 # v1.5.0
191+ with :
192+ egress-policy : audit # TODO: change to 'egress-policy: block' after couple of runs
193+
194+ - name : Check out repository
195+ uses : actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
196+ with :
197+ fetch-depth : 0
198+
199+ - name : Download provenance
200+ uses : actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # v3.0.0
201+ with :
202+ name : ${{ needs.provenance.outputs.attestation-name }}
203+
204+ - name : Upload provenance
205+ run : gh release upload ${{ needs.release.outputs.release-tag }} ${{ needs.provenance.outputs.attestation-name }}
206+ env :
207+ GH_TOKEN : ${{ secrets.REPO_ACCESS_TOKEN }}
0 commit comments