0.1.0 #3
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] | |
workflow_dispatch: | |
inputs: | |
repository: | |
description: 'PyPI repository to publish to (pypi or testpypi)' | |
required: true | |
default: 'pypi' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write # Required for private repositories and trusted publishers | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
python-version: '3.9' | |
cache: true | |
- name: Build Package | |
run: pdm build | |
- name: Set Repository | |
if: github.event_name == 'workflow_dispatch' | |
run: echo "PYPI_REPOSITORY=${{ github.event.inputs.repository }}" >> $GITHUB_ENV | |
- name: Publish Package | |
run: | | |
pdm publish --repository ${{ env.PYPI_REPOSITORY || 'pypi' }} |