Skip to content

Commit ed4859e

Browse files
committed
publish.yml: use trusted publishing instead of API token
1 parent f80a498 commit ed4859e

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

.github/workflows/publish.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- "v*"
1010

1111
jobs:
12-
build-n-publish:
12+
build:
1313
name: Build and publish distributions to PyPI
1414
if: github.repository == 'pvlib/pvlib-python'
1515
runs-on: ubuntu-latest
@@ -49,10 +49,27 @@ jobs:
4949
run: du -h pvlib
5050
working-directory: ./tmp
5151

52+
- name: Store the distribution packages
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: python-package-distributions
56+
path: dist/
57+
58+
publish:
5259
# only publish distribution to PyPI for tagged commits
60+
if: startsWith(github.ref, 'refs/tags/v')
61+
needs:
62+
- build
63+
runs-on: ubuntu-latest
64+
permissions:
65+
id-token: write # for PyPI trusted publishing
66+
67+
steps:
68+
- name: Download all dist files
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: python-package-distributions
72+
path: dist/
73+
5374
- name: Publish distribution to PyPI
54-
if: startsWith(github.ref, 'refs/tags/v')
5575
uses: pypa/gh-action-pypi-publish@release/v1
56-
with:
57-
user: __token__
58-
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)