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
# This workflow will upload a Python Package using Twine when a release is created | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Upload Python Package | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # for documentation builds | |
- name: Set up Python and dependencies | |
uses: ./.github/actions/setup-python | |
with: | |
pythonVersion: "3.10" | |
dependencyType: "dev" | |
- name: Install build tools | |
run: | | |
pip install build | |
python -m build | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
publish_docs: | |
name: Publish documentation | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # for documentation builds | |
- name: Set up Python and dependencies | |
uses: ./.github/actions/setup-python | |
with: | |
pythonVersion: "3.10" | |
dependencyType: "docs" | |
- name: Publish documentation | |
uses: ./.github/actions/mike-docs | |
with: | |
version: ${{ github.event.release.tag_name }} | |
alias: latest | |
push: true | |
publish_pypi: | |
name: Publish wheels to PyPI | |
needs: [build] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Publish Python 🐍 distribution 📦 to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true # tolerate release package file duplicates | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |