-
-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add GitHub artifact attestations for releases (#21953)
Add GitHub release attestations using the https://github.com/actions/attest-build-provenance/ action.
- Loading branch information
Showing
3 changed files
with
166 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
def action(name: str) -> str: | ||
version_map = { | ||
"action-send-mail": "dawidd6/[email protected]", | ||
"attest-build-provenance": "actions/attest-build-provenance@v2", | ||
"cache": "actions/cache@v4", | ||
"checkout": "actions/checkout@v4", | ||
"download-artifact": "actions/download-artifact@v4", | ||
|
@@ -880,6 +881,11 @@ def build_wheels_job( | |
"if": if_condition, | ||
"name": f"Build wheels ({str(platform.value)})", | ||
"runs-on": helper.runs_on(), | ||
"permissions": { | ||
"id-token": "write", | ||
"contents": "read", | ||
"attestations": "write", | ||
}, | ||
**({"container": container} if container else {}), | ||
**({"needs": needs} if needs else {}), | ||
"timeout-minutes": 90, | ||
|
@@ -913,6 +919,34 @@ def build_wheels_job( | |
helper.upload_log_artifacts(name="wheels-and-pex"), | ||
*( | ||
[ | ||
{ | ||
"name": "Attest the pantsbuild.pants wheel", | ||
"if": "needs.release_info.outputs.is-release == 'true'", | ||
"uses": action("attest-build-provenance"), | ||
"with": { | ||
"subject-path": "dist/deploy/wheels/pantsbuild.pants/**/pantsbuild.pants-*.whl", | ||
}, | ||
}, | ||
{ | ||
"name": "Rename the Pants Pex to its final name for upload", | ||
"if": "needs.release_info.outputs.is-release == 'true'", | ||
"run": dedent( | ||
"""\ | ||
PEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex | ||
mv dist/src.python.pants/pants-pex.pex dist/src.python.pants/$PEX_FILENAME | ||
""" | ||
), | ||
}, | ||
{ | ||
"name": "Attest the Pants Pex artifact", | ||
"if": "needs.release_info.outputs.is-release == 'true'", | ||
"uses": action("attest-build-provenance"), | ||
"with": { | ||
"subject-path": "dist/src.python.pants/*.pex", | ||
}, | ||
# Temporary: Allow errors in this step while we test the release workflow. | ||
"continue-on-error": True, | ||
}, | ||
{ | ||
"name": "Upload Wheel and Pex", | ||
"if": "needs.release_info.outputs.is-release == 'true'", | ||
|
@@ -927,8 +961,6 @@ def build_wheels_job( | |
PLAT=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import os;print(f'{os.uname().sysname.lower()}_{os.uname().machine.lower()}')") | ||
PEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex | ||
mv dist/src.python.pants/pants-pex.pex dist/src.python.pants/$PEX_FILENAME | ||
curl -L --fail \\ | ||
-X POST \\ | ||
-H "Authorization: Bearer ${{ github.token }}" \\ | ||
|
@@ -948,6 +980,16 @@ def build_wheels_job( | |
}, | ||
*( | ||
[ | ||
{ | ||
"name": "Attest the pantsbuild.pants.testutil wheel", | ||
"if": "needs.release_info.outputs.is-release == 'true'", | ||
"uses": action("attest-build-provenance"), | ||
"with": { | ||
"subject-path": "dist/deploy/wheels/pantsbuild.pants/**/pantsbuild.pants.testutil*.whl", | ||
}, | ||
# Temporary: Allow errors in this step while we test the release workflow. | ||
"continue-on-error": True, | ||
}, | ||
{ | ||
"name": "Upload testutil Wheel", | ||
"if": "needs.release_info.outputs.is-release == 'true'", | ||
|