Skip to content

Publish tagged releases to PyPI #78

Publish tagged releases to PyPI

Publish tagged releases to PyPI #78

name: Publish tagged releases to PyPI
on:
release:
types:
- published
workflow_run:
workflows:
- "Linting and type checking"
- "Run fast tests"
- "Run slow tests"
types:
- completed
jobs:
publish:
name: Build wheel and publish to test-PyPI, and then PyPI, and publish docs
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Poetry environment
uses: ./.github/setup-poetry-env
with:
python-version: ${{ matrix.python-version }}
- name: Setup test-PyPI credentials
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_TOKEN }}
- name: Build the wheel
run: poetry build
- name: Publish to test-PyPI
run: poetry publish -r testpypi
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish
- name: Build and publish docs
run: poetry run mkdocs gh-deploy --force