-
Howdy folks 👋. I'm trying to add the SLSA provenance generator reusable workflow to my release workflow, but I'm not sure how the
Question: What's the right way to include this attestation in what gets uploaded to PyPI? Any advice is greatly appreciated. Many thanks 🙂. Full workflow file, for reference…name: Semantic Release
on:
push:
branches:
- master
permissions:
contents: read
concurrency:
group: release
jobs:
release:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@2896129e02bb7809d2cf0c1b8e9e795ee27acbcf # v10.2.0
with:
git_committer_email: "[email protected]"
git_committer_name: "semantic-release"
github_token: ${{ secrets.GH_TOKEN }}
ssh_private_signing_key: ${{ secrets.SEMANTIC_RELEASE_PRIVATE_KEY }}
ssh_public_signing_key: ${{ secrets.SEMANTIC_RELEASE_PUBLIC_KEY }}
- name: Hash Build Artifacts
if: steps.release.outputs.released == 'true'
id: hash
run: |
cd dist
echo "hashes=$(find . -type f -exec sha256sum {} + | sort | base64 | tr -d '\n')" >> "$GITHUB_OUTPUT"
- name: Upload Build Artifacts
if: steps.release.outputs.released == 'true'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dist
path: dist/
outputs:
hashes: ${{ steps.hash.outputs.hashes }}
released: ${{ steps.release.outputs.released }}
provenance:
needs: release
if: ${{ needs.release.outputs.released == 'true' }}
permissions:
actions: read
id-token: write
contents: write
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
with:
base64-subjects: "${{ needs.release.outputs.hashes }}"
publish:
runs-on: ubuntu-latest
needs: [release, provenance]
if: ${{ needs.release.outputs.released == 'true' && needs.provenance.outputs.outcome == 'success' }}
environment: release
permissions:
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Download Build Artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: dist
path: dist
- name: Download Provenance
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ${{ needs.provenance.outputs.provenance-name }}
path: dist
- name: Publish to GitHub Releases
uses: python-semantic-release/publish-action@b717f67f7e7e9f709357bce5a542846503ce46ec # v10.2.0
with:
github_token: ${{ secrets.GH_TOKEN }}
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You can't, it's not something PyPI would accept. Keep it separate. You can put it into a GitHub Release instead. |
Beta Was this translation helpful? Give feedback.
Hey @jmgate, you're seeing that because PyPI expects an attestation object, not a Sigstore bundle (or a JSONL).
So, there are a few moving pieces here:
multiple.into.jsonl
contain multiple Sigstore bundles? If so, they'll need to each be broken out and turned into a separate attestation object fortwine
and other tools to upload them correctly.pypi-attestation
's API or CLI. Specifically, you'll probably needAttestation.from_bundle
.TL;DR: You're seein…