Skip to content

Upload Python Package #38

Upload Python Package

Upload Python Package #38

Workflow file for this run

# 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:
release:
types: [released]
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install poetry
run: pipx install poetry==1.8.3
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: '3.9'
cache: 'poetry'
- run: |
poetry config virtualenvs.in-project false
poetry config cache-dir ~/cache/.poetry
poetry config pypi-token.pypi "${{ secrets.API_TOKEN_PYPI }}"
poetry version ${{ github.ref_name }}
- name: Install dependencies
run: poetry install --with docs
- name: Build HTML
run: poetry run sphinx-build -a -E docs/source/ docs/build/
- name: Upload artifacts
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: html-docs
path: docs/build/html
- name: Deploy pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html
- name: Publish package
run: poetry publish --build