File tree Expand file tree Collapse file tree 1 file changed +31
-13
lines changed Expand file tree Collapse file tree 1 file changed +31
-13
lines changed Original file line number Diff line number Diff line change 10
10
- v*
11
11
12
12
jobs :
13
+ build-package :
14
+ runs-on : ubuntu-latest
15
+ permissions :
16
+ # write attestations and id-token are necessary for attest-build-provenance-github
17
+ attestations : write
18
+ id-token : write
19
+ steps :
20
+ - uses : actions/checkout@v4
21
+ with :
22
+ fetch-depth : 0
23
+ persist-credentials : false
24
+ - uses : hynek/build-and-inspect-python-package@v2
25
+ with :
26
+ # Prove that the packages were built in the context of this workflow.
27
+ attest-build-provenance-github : true
13
28
publish :
14
29
runs-on : ubuntu-latest
30
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
31
+ # Use the `release` GitHub environment to protect the Trusted Publishing (OIDC)
32
+ # workflow by requiring signoff from a maintainer.
33
+ environment : release
34
+ needs : build-package
35
+ permissions :
36
+ # write id-token is necessary for trusted publishing (OIDC)
37
+ id-token : write
15
38
steps :
16
- - uses : actions/checkout@v2
17
- - name : Set up Python
18
- uses : actions/setup-python@v4
39
+ - name : Download Distribution Artifacts
40
+ uses : actions/download-artifact@v4
19
41
with :
20
- python-version : " 3.10"
21
- - name : Install build dependencies
22
- run : python -m pip install build
23
- - name : Build package
24
- run : python -m build
25
- - name : Publish to PyPI
42
+ # The build-and-inspect-python-package action invokes upload-artifact.
43
+ # These are the correct arguments from that action.
44
+ name : Packages
45
+ path : dist
46
+ - name : Publish Package to PyPI
26
47
uses : pypa/gh-action-pypi-publish@release/v1
27
- if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
28
- with :
29
- user : __token__
30
- password : ${{ secrets.PYPI_API_TOKEN }}
48
+ # Implicitly attests that the packages were uploaded in the context of this workflow.
You can’t perform that action at this time.
0 commit comments