Release #19
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 to PyPI | |
on: | |
push: | |
tags: | |
- "v*" # Trigger on tags like v1.0.0, v2.1.0, etc. | |
workflow_dispatch: # Allow manual triggering | |
jobs: | |
pre-publish: | |
name: Prepare to Publish | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
run: uv python install ${{ matrix.python-version }} | |
- name: Install the project | |
run: uv sync --all-extras --dev | |
- name: Run smoke tests | |
run: uv run wled2graph --help | |
- name: Build the package | |
run: uv build | |
publish: | |
name: Publish to PyPI | |
needs: pre-publish | |
runs-on: ubuntu-latest | |
environment: release | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
run: uv python install ${{ matrix.python-version }} | |
- name: Install the project | |
run: uv sync --all-extras --dev | |
- name: Build the package | |
run: uv build | |
- name: Publish to PyPI | |
if: ${{ github.event_name == 'workflow_dispatch' }} # Ensure this step runs only on manual trigger | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: uv publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} |