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 Python 🐍 distributions 📦 to PyPI | |
on: | |
release: | |
types: | |
- published | |
permissions: | |
contents: read | |
jobs: | |
build-n-publish-pypi: | |
name: Build and publish Python 🐍 distributions 📦 to PyPI | |
environment: production | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
files.pythonhosted.org:443 | |
ghcr.io:443 | |
github.com:443 | |
pypi.org:443 | |
ruf-repo-cdn.sigstore.dev:443 | |
upload.pypi.org:443 | |
- name: Checkout Repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Python3 | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: "3.x" | |
- name: Install CI libraries | |
run: | | |
python -m pip install --require-hashes -r CI/requirements_ci.txt | |
- name: Build a binary wheel and a source tarball | |
run: | | |
python -m flit build | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # v1.12.2 |