Skip to content

Publish library to PyPI #6

Publish library to PyPI

Publish library to PyPI #6

Workflow file for this run

name: "Publish library to PyPI"
on:
workflow_run:
workflows: ["Setup, Build, and Test"]
types:
- completed
branches:
- main
jobs:
publish:
name: Publish library
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
python-version: ["3.11"]
permissions:
contents: read
actions: read # IMPORTANT: mandatory for downloading artifacts
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Download built package
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
name: built-package
path: dist/
- name: Publish package to PyPI
run: poetry publish --username '__token__' --password ${{ secrets.PYPI_API_KEY }} --distributions-dir dist