Skip to content

Skip existing releases when publishing to TestPyPI πŸ— #22

Skip existing releases when publishing to TestPyPI πŸ—

Skip existing releases when publishing to TestPyPI πŸ— #22

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