From 3624186fb668d4d95a99a9016678f9b88233ec43 Mon Sep 17 00:00:00 2001 From: Evandro Myller Date: Mon, 30 Nov 2026 19:25:00 -0300 Subject: [PATCH 1/4] ci: Publish to PyPI without a stored API token Authenticate releases as a PyPI trusted publisher (OIDC) instead of the long-lived PYPI_API_TOKEN secret. The workflow is renamed to publish.yml, the filename PyPI trusts, and the build runs in a job that holds no publishing rights. Co-Authored-By: Claude Fable 5.2 --- .github/workflows/publish-pypi-package.yml | 28 ------------ .github/workflows/publish.yml | 50 ++++++++++++++++++++++ 2 files changed, 50 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/publish-pypi-package.yml create mode 100644 .github/workflows/publish.yml 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..3eb4a20c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,50 @@ +name: Publish PyPI Package + +on: + push: + tags: + - '*' + +permissions: + contents: read # Build from source + +jobs: + build: + runs-on: ubuntu-latest + name: Build PyPI Package + + steps: + - name: Cloning repo + uses: actions/checkout@v7 + 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@v7 + with: + name: dist + path: dist/ + + publish: + runs-on: ubuntu-latest + name: Publish PyPI Package + needs: build + + permissions: + id-token: write # Authenticate to PyPI via OIDC + + steps: + - name: Download distributions + uses: actions/download-artifact@v8 + with: + name: dist + path: dist/ + + - name: Publish Package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From 39cc907a6eeac7c467e50ee8bcaab20e48d63e7c Mon Sep 17 00:00:00 2001 From: Evandro Myller Date: Tue, 1 Dec 2026 10:38:29 -0300 Subject: [PATCH 2/4] pypi env --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3eb4a20c..18928ffd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -35,6 +35,7 @@ jobs: runs-on: ubuntu-latest name: Publish PyPI Package needs: build + environment: pypi permissions: id-token: write # Authenticate to PyPI via OIDC From c83f6063b05877dd134fc927f2ce7e9b53604d4d Mon Sep 17 00:00:00 2001 From: Evandro Myller Date: Tue, 1 Dec 2026 11:03:17 -0300 Subject: [PATCH 3/4] v --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 18928ffd..e05b6462 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,7 +3,7 @@ name: Publish PyPI Package on: push: tags: - - '*' + - v* permissions: contents: read # Build from source From 6b99f434b73135803044c46895e041d4535b70b0 Mon Sep 17 00:00:00 2001 From: Evandro Myller Date: Tue, 1 Dec 2026 11:04:26 -0300 Subject: [PATCH 4/4] =?UTF-8?q?sha=20=F0=9F=AB=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e05b6462..8c602fb8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Cloning repo - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 persist-credentials: false @@ -26,7 +26,7 @@ jobs: python -m build - name: Upload distributions - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: dist path: dist/ @@ -42,10 +42,10 @@ jobs: steps: - name: Download distributions - uses: actions/download-artifact@v8 + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: dist path: dist/ - name: Publish Package to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3