Release #21
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: Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
workflow_dispatch: | |
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 --upgrade | |
- name: Run smoke tests | |
run: uv run wled2graph --help | |
- name: Build the package | |
run: uv build | |
- name: Cache build artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
dist | |
build | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-build- | |
publish: | |
name: Publish to PyPI | |
needs: pre-publish | |
runs-on: ubuntu-latest | |
environment: release | |
steps: | |
- name: Restore build artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
dist | |
build | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-build- | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Publish to PyPI | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: uv publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} |