Skip to content

Publish to PyPI

Publish to PyPI #2

Workflow file for this run

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 }}'