diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 253ef46..bddebce 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,19 +1,6 @@ -# This workflow will upload a Python Package to PyPI when a release is created -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries +name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Upload Python Package - -on: - release: - types: [published] - -permissions: - contents: read +on: push jobs: build: @@ -28,7 +15,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.10" - - name: Install pypa/build run: >- python3 -m @@ -43,6 +29,28 @@ jobs: name: python-package-distributions path: dist/ + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/pyneon # Replace with your PyPI project name + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + publish-to-testpypi: name: Publish Python 🐍 distribution 📦 to TestPyPI needs: