Publish tagged releases to PyPI #78
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 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 |