Update pyproject.toml #2
Workflow file for this run
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: | |
# release: | |
# types: [published] # Trigger the workflow when a release is published. | |
on: | |
push: | |
tags: | |
- "v*.*.*" # Trigger only on version tags | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Set up Python environment | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.7 | |
# Cache Poetry dependencies for faster builds | |
- name: Cache Poetry dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pypoetry | |
~/.venv | |
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
# Install Poetry | |
- name: Install Poetry | |
run: curl -sSL https://install.python-poetry.org | python3 - | |
# Install dependencies using Poetry | |
- name: Install dependencies | |
run: poetry install --no-root | |
# Build the package using Poetry | |
- name: Build the package | |
run: poetry build | |
- name: Publish to PyPI | |
env: | |
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: poetry publish --username $TWINE_USERNAME --password $TWINE_PASSWORD |