Upload Python Package #29
This file contains hidden or 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://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
| name: Upload Python Package | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_part: | |
| description: 'Which part of the version to increment (patch, minor, major)' | |
| required: true | |
| default: 'patch' | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync --python 3.14 --group release | |
| - name: Configure git | |
| run: | | |
| git config --local user.email "skullydazed@gmail.com" | |
| git config --local user.name "Zach White" | |
| - name: Generate documentation | |
| run: | | |
| uv run ./generate_docs --commit | |
| - name: Bump version | |
| run: | | |
| uv run bumpversion ${{ github.event.inputs.version_part }} | |
| - name: Generate changelog | |
| run: | | |
| uv run gitchangelog > CHANGELOG.rst | |
| git add CHANGELOG.rst | |
| git commit -m'minor: changelog update' | |
| - name: Push changes | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: master | |
| tags: true | |
| - name: Update docs | |
| run: | | |
| uv run ./release_docs latest | |
| - name: Build and publish | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
| run: | | |
| uv build | |
| uv run twine upload dist/* |