Merge pull request #1189 from pypa/release-6.0.1 #6
Workflow file for this run
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
name: Publish to PyPI | |
on: | |
push: | |
tags: | |
- "*" | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: "Build dists" | |
runs-on: "ubuntu-latest" | |
environment: | |
name: "publish" | |
outputs: | |
hashes: ${{ steps.hash.outputs.hashes }} | |
steps: | |
- name: "Checkout repository" | |
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" | |
- name: "Setup Python" | |
uses: "actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b" | |
with: | |
python-version: "3.x" | |
- name: "Install dependencies" | |
run: python -m pip install build | |
- name: "Build dists" | |
run: | | |
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) \ | |
python -m build | |
- name: "Generate hashes" | |
id: hash | |
run: | | |
cd dist && echo "hashes=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT | |
- name: "Upload dists" | |
uses: "actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882" | |
with: | |
name: "dist" | |
path: "dist/" | |
if-no-files-found: error | |
retention-days: 5 | |
provenance: | |
needs: [build] | |
permissions: | |
actions: read | |
contents: write | |
id-token: write # Needed to access the workflow's OIDC identity. | |
uses: "slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0" | |
with: | |
base64-subjects: "${{ needs.build.outputs.hashes }}" | |
upload-assets: true | |
compile-generator: true # Workaround for https://github.com/slsa-framework/slsa-github-generator/issues/1163 | |
publish: | |
name: "Publish to PyPI" | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: ["build", "provenance"] | |
permissions: | |
contents: write | |
id-token: write | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "Download dists" | |
uses: "actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16" | |
with: | |
name: "dist" | |
path: "dist/" | |
- name: "Publish dists to PyPI" | |
uses: "pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc" |