Skip to content

Commit

Permalink
attestation-bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Oct 8, 2024
1 parent 1ea8a09 commit cab03ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,17 @@ jobs:
run: |
python -m pypi_attestations inspect dist/*.publish.attestation
- name: Upload attestations bundles
- name: Prepare attestation bundles for uploading
run: |
mkdir -p /tmp/attestation-bundles
cp "${{ steps.attest.outputs.bundle-path }}" /tmp/attestation-bundles/
cp dist/*.publish.attestation /tmp/attestation-bundles/
- name: Upload attestation bundles
uses: actions/upload-artifact@v4
with:
name: attestations
path: |
${{ steps.attest.outputs.bundle-path }}
dist/*.publish.attestation
name: attestation-bundles
path: /tmp/attestation-bundles/

- name: Mint PyPI API token
id: mint-token
Expand Down
5 changes: 2 additions & 3 deletions utils/convert_attestations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
See https://github.com/trailofbits/pypi-attestations.
"""

import base64
import json
import sys
from base64 import b64decode
from pathlib import Path

from pypi_attestations import Attestation, Distribution
Expand All @@ -19,7 +19,7 @@

for line in bundle_path.read_bytes().splitlines():
dsse_envelope_payload = json.loads(line)['dsseEnvelope']['payload']
subjects = json.loads(base64.b64decode(dsse_envelope_payload))['subject']
subjects = json.loads(b64decode(dsse_envelope_payload))['subject']
for subject in subjects:
filename = subject['name']
assert (DIST / filename).is_file()
Expand All @@ -28,7 +28,6 @@
print(f'Converting attestation for {filename}')
sigstore_bundle = Bundle.from_json(line)
attestation = Attestation.from_bundle(sigstore_bundle)
print(attestation.model_dump_json())
attestation_path = DIST / f'{filename}.publish.attestation'
attestation_path.write_text(attestation.model_dump_json())
print(f'Attestation for {filename} written to {attestation_path}')
Expand Down

0 comments on commit cab03ec

Please sign in to comment.