From 7ab4da6575bc9f1318ec99b46b59877fae5336b9 Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Tue, 19 May 2026 13:24:07 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Switch=20PyPI=20publishing=20to?= =?UTF-8?q?=20trusted=20publishing=20(OIDC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace long-lived API token with PyPI trusted publishing via pypa/gh-action-pypi-publish. This uses short-lived OIDC credentials scoped to the CI workflow, eliminating the need for stored secrets. --- .github/workflows/tests.yml | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 39d122d..588482f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,23 +65,20 @@ jobs: publish: - name: Publish to PyPi + name: Publish to PyPI needs: [pre-commit, tests] if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') runs-on: ubuntu-latest + permissions: + id-token: write + environment: + name: pypi + url: https://pypi.org/p/mdit-py-plugins steps: - - name: Checkout source - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: "3.10" - - name: install flit - run: | - pip install flit~=3.4 - - name: Build and publish - run: | - flit publish - env: - FLIT_USERNAME: __token__ - FLIT_PASSWORD: ${{ secrets.PYPI_KEY }} + - run: pip install flit~=3.4 + - run: flit build + - uses: pypa/gh-action-pypi-publish@release/v1