Skip existing releases when publishing to TestPyPI π #22
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: "[PyPI] π¦ Publish Python π distribution" | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
jobs: | |
build-package: | |
uses: ./.github/workflows/workflow-build-package.yml | |
with: | |
python_version: "3.x" | |
poetry_version: "1.5.1" | |
generate_temp_version: ${{ github.event_name == 'pull_request' && true || false }} | |
publish-to-pypi: | |
name: Publish Python π distribution π¦ to PyPI | |
# only publish to PyPI on tag pushes | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: | |
- build-package | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/hapless | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish distribution π¦ to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |