Skip to content

Release

Release #1

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
dry_run:
description: 'If "true", publish to TestPyPI (requires TEST_PYPI_TOKEN).'
required: false
default: 'false'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: pip
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
- name: Build release artifacts
run: python -m build
- name: Validate artifacts
run: twine check dist/*
- name: Publish to TestPyPI (dry-run)
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true' }}
run: |
python -m pip install --upgrade pip
python -m pip install twine
twine upload --repository-url https://test.pypi.org/legacy/ dist/* -u __token__ -p ${{ secrets.TEST_PYPI_TOKEN }}
- name: Publish to PyPI
if: ${{ !(github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true') }}
uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
dist/*