File tree Expand file tree Collapse file tree 3 files changed +36
-26
lines changed Expand file tree Collapse file tree 3 files changed +36
-26
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -77,23 +77,24 @@ jobs:
77
77
predicate : " null"
78
78
show-summary : " true"
79
79
80
- - uses : actions/upload-artifact@v4
80
+ - name : Upload sigstore JSONL attestations bundle
81
+ uses : actions/upload-artifact@v4
81
82
with :
82
83
name : sigstore-bundle
83
84
path : ${{ steps.attest.outputs.bundle-path }}
84
85
85
- # - name: Generate PEP 740 attestations
86
- # run: |
87
- # python -m pypi_attestations sign dist/*
88
- #
89
- # - name: Inspect PEP 740 attestations
90
- # run: |
91
- # python -m pypi_attestations inspect dist/*.publish.attestation
92
- #
93
- # - name: Verify PEP 740 attestations
94
- # run: |
95
- # python -m pypi_attestations verify dist/*.whl --identity https://github.com/${{ github.repository }}/.github/workflows/create-release.yml@${{ github.ref }}
96
- # python -m pypi_attestations verify dist/*.tar.gz --identity https://github.com/${{ github.repository }}/.github/workflows/create-release.yml@${{ github.ref }}
86
+ - name : Convert attestations to PEP 740
87
+ run : python utils/convert_attestations.py "${{ steps.attest.outputs.bundle-path }}"
88
+
89
+ - name : Inspect PEP 740 attestations
90
+ run : |
91
+ python -m pypi_attestations inspect dist/*.publish.attestation
92
+
93
+ - name : Verify PEP 740 attestations
94
+ # workflow_ref example: sphinx-doc/sphinx/.github/workflows/create-release.yml@refs/heads/master
95
+ run : |
96
+ python -m pypi_attestations verify dist/*.whl --identity https://github.com/${{ github.workflow_ref }}
97
+ python -m pypi_attestations verify dist/*.tar.gz --identity https://github.com/${{ github.workflow_ref }}
97
98
98
99
# - name: Upload to PyPI
99
100
# env:
Original file line number Diff line number Diff line change
1
+ import base64
2
+ import json
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ from pypi_attestations import Attestation
7
+ from sigstore .models import Bundle
8
+
9
+ DIST = Path ('dist' )
10
+
11
+ bundle_path = Path (sys .argv [1 ])
12
+ for line in bundle_path .read_bytes ().splitlines ():
13
+ dsse_envelope_payload = json .loads (line )['dsseEnvelope' ]['payload' ]
14
+ subjects = json .loads (base64 .b64decode (dsse_envelope_payload ))['subject' ]
15
+ for subject in subjects :
16
+ filename = subject ['name' ]
17
+ sigstore_bundle = Bundle .from_json (line )
18
+ attestation = Attestation .from_bundle (sigstore_bundle )
19
+ print (attestation .model_dump_json ())
20
+ signature_path = DIST / f'{ filename } .publish.attestation'
21
+ signature_path .write_text (attestation .model_dump_json ())
22
+ print (f'Attestation for { filename } written to { signature_path } ' )
You can’t perform that action at this time.
0 commit comments