pypi: Automatic Releases #1
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: Upload release to PyPI (Test & Live) | |
on: | |
push: | |
branches: [automatic-pypi-releases] | |
release: | |
types: [published] | |
jobs: | |
pypi-publish: | |
name: Upload release to PyPI (Test & Live) | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/PROJECTNAME | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- run: pip install --upgrade build | |
- run: python -m build --sdist --wheel | |
- name: Publish package distributions to TEST PyPI | |
if: github.event_name == 'push' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true | |
- name: Publish package distributions to LIVE PyPI | |
if: github.event_name == 'release' | |
uses: pypa/gh-action-pypi-publish@release/v1 |