Skip to content

trigger-publish

trigger-publish #26

Workflow file for this run

name: Publish Python Package
on:
release:
types: [published]
repository_dispatch:
types: [trigger-publish]
# Allow manual triggers for testing the workflow
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Check Poetry version
run: poetry --version
- name: Update poetry.lock
run: poetry lock
- name: Install dependencies
run: poetry install --no-interaction
- name: Run tests
run: poetry run pytest
- name: Extract version
id: get_version
run: |
# Always get the version from the pyproject.toml file
# This should be correct since we're checking out the repo after the version bump
VERSION=$(poetry version -s)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Using version: $VERSION"
- name: Build package
run: poetry build
- name: Publish to PyPI
if: success()
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: poetry publish