Version 3.11.1 #54
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: | |
release: | |
types: | |
- created | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: "Build dists" | |
runs-on: "ubuntu-latest" | |
outputs: | |
hashes: ${{ steps.hash.outputs.hashes }} | |
steps: | |
- name: "Checkout repository" | |
uses: "actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871" | |
- 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 "::set-output name=hashes::$(sha256sum * | base64 -w0)" | |
- name: "Upload dists" | |
uses: "actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874" | |
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/[email protected]" | |
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" | |
if: startsWith(github.ref, 'refs/tags/') | |
environment: | |
name: pypi | |
url: https://pypi.org/p/niquests | |
needs: ["build", "provenance"] | |
permissions: | |
contents: write | |
id-token: write # Needed for trusted publishing to PyPI. | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "Download dists" | |
uses: "actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395" | |
with: | |
name: "dist" | |
path: "dist/" | |
- name: "Upload dists to GitHub Release" | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
run: | | |
gh release upload ${{ github.ref_name }} dist/* --repo ${{ github.repository }} | |
- name: "Publish dists to PyPI" | |
uses: "pypa/gh-action-pypi-publish@0ab0b79471669eb3a4d647e625009c62f9f3b241" # v1.10.1 |