Skip to content

Commit 99c3047

Browse files
authored
Use trusted publishing (#330)
In light of the recent npm supply chain attacks and also https://blog.pypi.org/posts/2025-09-16-github-actions-token-exfiltration/, I'm combing through our font stack to see if all them Py projects are using the trusted publisher mechanism as recommended by PyPI. See https://docs.pypi.org/trusted-publishers/ and https://docs.astral.sh/uv/guides/integration/github/#publishing-to-pypi. Someone needs to do three things for this PR to work: * Create an environment called "publish-to-pypi" in this GitHub repository under Settings -> Environments. Creating alone is probably enough, no configuration needed I think. * Follow https://docs.pypi.org/trusted-publishers/adding-a-publisher/ to set up the other side on PyPI. * Remove tokens/secret variables here so they can't be exfiltrated anymore, and probably also remove them from PyPI. I'm not sure if one needs to do anything to make twine pick up the new creds, trusted publishing should be supported in v6.1.0.
1 parent 0ad923d commit 99c3047

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

.github/workflows/publish-package.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ jobs:
2323
deploy:
2424

2525
runs-on: ubuntu-latest
26+
environment:
27+
name: publish-to-pypi
28+
url: https://pypi.org/p/fontMath
29+
permissions:
30+
id-token: write # IMPORTANT: mandatory for trusted publishing.
2631

2732
steps:
2833
- uses: actions/checkout@v3.5.3
@@ -35,9 +40,6 @@ jobs:
3540
python -m pip install --upgrade pip
3641
pip install setuptools wheel twine
3742
- name: Build and publish
38-
env:
39-
TWINE_USERNAME: __token__
40-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
4143
run: |
4244
python setup.py sdist bdist_wheel
4345
twine upload dist/*

0 commit comments

Comments
 (0)