From 5f75ba24544fb3f16ab7b8f477334fa47da1a1b2 Mon Sep 17 00:00:00 2001 From: Tom White Date: Wed, 15 Jan 2025 12:30:45 +0000 Subject: [PATCH] Use trusted publishers for PyPI releases --- .github/workflows/release.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 35d14c2d..7d388ebd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,10 @@ jobs: build-artifacts: if: github.repository == 'cubed-dev/cubed' runs-on: ubuntu-latest + environment: pypi + permissions: + # IMPORTANT: this permission is mandatory for Trusted Publishing + id-token: write steps: - name: Checkout source uses: actions/checkout@v3 @@ -43,13 +47,17 @@ jobs: if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@release/v1 with: - password: ${{ secrets.TEST_PYPI_API_TOKEN }} repository-url: https://test.pypi.org/legacy/ + verbose: true upload-to-pypi: needs: build-artifacts if: github.event_name == 'release' runs-on: ubuntu-latest + environment: pypi + permissions: + # IMPORTANT: this permission is mandatory for Trusted Publishing + id-token: write steps: - name: Download artifacts uses: actions/download-artifact@v4 @@ -59,4 +67,4 @@ jobs: - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - password: ${{ secrets.PYPI_API_TOKEN }} + verbose: true