Skip to content

Commit e25f15f

Browse files
authored
Switch to PyPI trusted publishing (#420)
Doing this means we can remove the long-lived `PYPI_API_TOKEN` from this repo, which improves security. See https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/ for more details. N.B. I'm also bumping `pre-commit-hooks` here -- I did this for our pyproject.toml file in #419, but forgot to update the same pin in our `.pre-commit-config.yaml` file. Doesn't feel like it deserves its own PR :p
1 parent 3aa8acf commit e25f15f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.github/workflows/publish.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
build-n-publish:
1313
name: Build and publish Python distributions to PyPI
1414
runs-on: ubuntu-20.04
15+
permissions:
16+
# needed for PyPI trusted publishing
17+
id-token: write
1518
steps:
1619
- uses: actions/checkout@v4
1720
- name: Set up Python 3.10
@@ -35,5 +38,3 @@ jobs:
3538
- name: Publish distribution to PyPI
3639
if: startsWith(github.ref, 'refs/tags')
3740
uses: pypa/gh-action-pypi-publish@release/v1
38-
with:
39-
password: ${{ secrets.PYPI_API_TOKEN }}

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0 # must match pyproject.toml
3+
rev: v4.5.0 # must match pyproject.toml
44
hooks:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer

0 commit comments

Comments
 (0)