Support publishing to PyPI using the trusted publisher mechanism #17
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: Release to PyPI | |
on: | |
release: | |
types: [ published ] | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
concurrency: | |
group: pypi-release | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ vars.PYTHON_VERSION }} | |
- name: Install Poetry | |
run: curl -sSL https://install.python-poetry.org | python3 - | |
- name: Validate Release Version | |
run: poetry version -s | grep -E "$(echo "$GITHUB_REF_NAME" | tr -d 'v')" | |
- name: Publish to PyPI | |
run: poetry build | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: dist/ | |
if-no-files-found: error | |
release: | |
runs-on: ubuntu-latest | |
environment: | |
name: release | |
needs: | |
- build | |
# permissions: | |
# id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: dist/ | |
- run: ls -laR | |
# - name: Publish package distributions to PyPI | |
# uses: pypa/gh-action-pypi-publish@release/v1.12.2 |