Skip to content

Commit 6e1133d

Browse files
authored
🔧 Switch PyPI publishing to trusted publishing (OIDC) (#142)
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.
1 parent da70e05 commit 6e1133d

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

‎.github/workflows/tests.yml‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,20 @@ jobs:
6565

6666
publish:
6767

68-
name: Publish to PyPi
68+
name: Publish to PyPI
6969
needs: [pre-commit, tests]
7070
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
7171
runs-on: ubuntu-latest
72+
permissions:
73+
id-token: write
74+
environment:
75+
name: pypi
76+
url: https://pypi.org/p/mdit-py-plugins
7277
steps:
73-
- name: Checkout source
74-
uses: actions/checkout@v4
75-
- name: Set up Python
76-
uses: actions/setup-python@v5
78+
- uses: actions/checkout@v4
79+
- uses: actions/setup-python@v5
7780
with:
7881
python-version: "3.10"
79-
- name: install flit
80-
run: |
81-
pip install flit~=3.4
82-
- name: Build and publish
83-
run: |
84-
flit publish
85-
env:
86-
FLIT_USERNAME: __token__
87-
FLIT_PASSWORD: ${{ secrets.PYPI_KEY }}
82+
- run: pip install flit~=3.4
83+
- run: flit build
84+
- uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)