diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 86d431d74..dee106473 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -115,8 +115,12 @@ jobs: if: | (github.repository == 'PolicyEngine/policyengine-core') && (github.event.head_commit.message == 'Update PolicyEngine Core') + # PyPI trusted publishing: PyPI accepts uploads only from this workflow in + # the pypi environment, which is limited to master. No stored PyPI token. + environment: pypi permissions: contents: write + id-token: write steps: - name: Checkout repo uses: actions/checkout@v6 @@ -135,8 +139,6 @@ jobs: - name: Publish a Python distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - user: __token__ - password: ${{ secrets.PYPI }} skip-existing: true - name: Publish a git tag run: bash .github/publish-git-tag.sh diff --git a/changelog.d/trusted-publishing.changed.md b/changelog.d/trusted-publishing.changed.md new file mode 100644 index 000000000..2a24b561b --- /dev/null +++ b/changelog.d/trusted-publishing.changed.md @@ -0,0 +1 @@ +- Publish to PyPI with trusted publishing instead of the organisation-wide PyPI token.