Publish to PyPI #2
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: | |
- v*.*.* | |
jobs: | |
package: | |
environment: PyPI | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
name: Publish Python code | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install build package | |
run: python -m pip install -U build | |
- name: Build a wheel and source tarball | |
run: python -m build --sdist --wheel --outdir dist | |
- name: Publish distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: startsWith(github.ref, 'refs/tags') | |
release: | |
environment: GitHub Releases | |
runs-on: ubuntu-latest | |
permissions: write-all | |
if: "!contains(github.ref, 'rc') && !contains(github.ref, 'alpha')" | |
name: Release | |
needs: package | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rasmus-saks/[email protected] | |
with: | |
github-token: '${{ secrets.GITHUB_TOKEN }}' |