diff --git a/.github/workflows/publish-pypi-package.yml b/.github/workflows/publish-pypi-package.yml deleted file mode 100644 index cad740a6..00000000 --- a/.github/workflows/publish-pypi-package.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Publish Pypi Package - -on: - push: - tags: - - '*' - -jobs: - package: - runs-on: ubuntu-latest - name: Publish Pypi Package - - steps: - - name: Cloning repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Build binary wheel and a source tarball - run: | - python -m pip install build - python -m build - - - name: Publish Package to Pypi - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..8c602fb8 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,51 @@ +name: Publish PyPI Package + +on: + push: + tags: + - v* + +permissions: + contents: read # Build from source + +jobs: + build: + runs-on: ubuntu-latest + name: Build PyPI Package + + steps: + - name: Cloning repo + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Build binary wheel and a source tarball + run: | + python -m pip install build + python -m build + + - name: Upload distributions + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: dist + path: dist/ + + publish: + runs-on: ubuntu-latest + name: Publish PyPI Package + needs: build + environment: pypi + + permissions: + id-token: write # Authenticate to PyPI via OIDC + + steps: + - name: Download distributions + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: dist + path: dist/ + + - name: Publish Package to PyPI + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3