Publish to PyPi #62
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 | |
# This will publish a package to TestPyPi (and real Pypi if run on master) with a version | |
# number generated by versioneer from the most recent tag looking like v____ | |
# TODO: maybe move this into the package job so all release-based actions are together | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build-n-publish: | |
name: Build dist files for PyPi | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Build dist files | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e .[test] build | |
python -m build | |
git describe --tag --dirty --always | |
- name: Publish distribution 📦 to Test PyPI # always run | |
uses: pypa/gh-action-pypi-publish@release/v1 # license BSD-2 | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
- name: Publish distribution 📦 to PyPI | |
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }} | |
uses: pypa/gh-action-pypi-publish@release/v1 # license BSD-2 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |