Skip to content

Commit 2640077

Browse files
committed
release machinery: fix attestation and circleci
1 parent a6e4941 commit 2640077

File tree

3 files changed

+30
-16
lines changed

3 files changed

+30
-16
lines changed

.circleci/config.yml

+10
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,15 @@ jobs:
5252
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
5353
workflows:
5454
build-arm:
55+
when:
56+
equal: [ "", << pipeline.parameters.GHA_Actor >> ]
57+
jobs:
58+
- linux-arm-wheels
59+
60+
# run a separate, identical release job only if triggered
61+
build-arm-release:
62+
when:
63+
not:
64+
equal: [ "", << pipeline.parameters.GHA_Actor >> ]
5565
jobs:
5666
- linux-arm-wheels

.github/workflows/release-gh-draft.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ jobs:
3232
draft-release:
3333
needs: [manylinux-aarch64, manylinux, macos, windows, sdist]
3434
runs-on: ubuntu-latest
35+
permissions:
36+
id-token: write
37+
attestations: write
38+
contents: write
39+
3540
steps:
3641
- uses: actions/[email protected]
3742

@@ -55,13 +60,10 @@ jobs:
5560
id: ver
5661
run: echo "VER=${GITHUB_REF_NAME#'release/'}" >> $GITHUB_OUTPUT
5762

58-
# First generate release.sha512sum which contains hashes of all release files, then
59-
# encrypt these hashes so that the hash file itself cannot be tampered with.
60-
- name: Generate release hashes (encrypted)
61-
run: |
62-
cd pygame-wheels
63-
sha512sum * > release.sha512sum
64-
gpg --batch --output release.sha512sum.gpg --passphrase ${{ secrets.GITHUB_TOKEN }} --symmetric release.sha512sum
63+
- name: Generate release attestation
64+
uses: actions/[email protected]
65+
with:
66+
subject-path: "pygame-wheels/*"
6567

6668
- name: Draft a release
6769
uses: softprops/action-gh-release@v2

.github/workflows/release-pypi.yml

+11-9
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,18 @@ jobs:
2323
zipBall: false
2424
out-file-path: "dist"
2525

26-
# Check that all the files that successfully uploaded from the release-gh-draft
27-
# action have not been tampered with. This however ignores any extra files that
28-
# were manually added.
29-
- name: Verify release hashes
26+
- name: Verify release attestation
27+
env:
28+
GH_TOKEN: ${{ github.token }}
3029
run: |
31-
cd dist
32-
gpg --batch --output release.decrypted.sha512sum --passphrase ${{ secrets.GITHUB_TOKEN }} --decrypt release.sha512sum.gpg
33-
diff -s release.sha512sum release.decrypted.sha512sum
34-
sha512sum -c release.decrypted.sha512sum
35-
rm release.*
30+
for fname in dist/*; do
31+
if gh attestation verify $fname -R ${{ github.repository }}; then
32+
echo "[ALLOWED] $fname"
33+
else
34+
rm $fname
35+
echo "[DELETED] $fname"
36+
fi
37+
done
3638
3739
- name: Publish to PyPI
3840
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)