Skip to content

Commit 880b802

Browse files
authored
publish.yml: use trusted publishing instead of API token (#2549)
* publish.yml: use trusted publishing instead of API token * better job names * better name for overall workflow
1 parent f80a498 commit 880b802

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

.github/workflows/publish.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish distributions to PyPI
1+
name: Package build
22

33
on:
44
pull_request:
@@ -9,8 +9,8 @@ on:
99
- "v*"
1010

1111
jobs:
12-
build-n-publish:
13-
name: Build and publish distributions to PyPI
12+
build:
13+
name: Build wheel and sdist
1414
if: github.repository == 'pvlib/pvlib-python'
1515
runs-on: ubuntu-latest
1616
steps:
@@ -49,10 +49,28 @@ 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:
59+
name: Release dist files to PyPI
5260
# only publish distribution to PyPI for tagged commits
61+
if: startsWith(github.ref, 'refs/tags/v')
62+
needs:
63+
- build
64+
runs-on: ubuntu-latest
65+
permissions:
66+
id-token: write # for PyPI trusted publishing
67+
68+
steps:
69+
- name: Download all dist files
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: python-package-distributions
73+
path: dist/
74+
5375
- name: Publish distribution to PyPI
54-
if: startsWith(github.ref, 'refs/tags/v')
5576
uses: pypa/gh-action-pypi-publish@release/v1
56-
with:
57-
user: __token__
58-
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)