44 push :
55 tags :
66 - " v*"
7+ workflow_dispatch :
8+ inputs :
9+ test-pypi-only :
10+ description : " Publish to Test PyPI only"
11+ type : boolean
12+ default : true
713
814permissions :
915 contents : read
@@ -12,41 +18,28 @@ jobs:
1218 build :
1319 name : " Build dists"
1420 runs-on : " ubuntu-latest"
15- environment :
16- name : " publish"
1721 outputs :
18- hashes : ${{ steps.hash.outputs.hashes }}
1922 artifact-id : ${{ steps.upload-artifact.outputs.artifact-id }}
2023
2124 steps :
22- - name : Harden the runner (Audit all outbound calls)
23- uses : step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
24- with :
25- egress-policy : audit
26-
2725 - name : " Checkout repository"
28- uses : " actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd"
26+ uses : " actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
2927 with :
3028 persist-credentials : false
3129
3230 - name : " Setup Python"
33- uses : " actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405"
31+ uses : " actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405" # v6.2.0
3432 with :
3533 python-version : " 3.x"
3634
3735 - name : " Install dependencies"
38- run : python -m pip install build==0.8 .0
36+ run : python -m pip install build==1.4 .0
3937
4038 - name : " Build dists"
4139 run : |
4240 SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) \
4341 python -m build
4442
45- - name : " Generate hashes"
46- id : hash
47- run : |
48- cd dist && echo "::set-output name=hashes::$(sha256sum * | base64 -w0)"
49-
5043 - name : " Upload dists"
5144 uses : " actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f"
5245 id : upload-artifact
@@ -56,38 +49,47 @@ jobs:
5649 if-no-files-found : error
5750 retention-days : 5
5851
59- provenance :
60- needs : [build]
61- permissions :
62- actions : read
63- contents : write
64- id-token : write # Needed to access the workflow's OIDC identity.
65- uses : " slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0"
66- with :
67- base64-subjects : " ${{ needs.build.outputs.hashes }}"
68- upload-assets : true
69- compile-generator : true # Workaround for https://github.com/slsa-framework/slsa-github-generator/issues/1163
70-
7152 publish :
7253 name : " Publish"
7354 if : startsWith(github.ref, 'refs/tags/')
74- needs : ["build", "provenance" ]
55+ needs : ["build"]
7556 permissions :
76- contents : write
7757 id-token : write
7858 runs-on : " ubuntu-latest"
59+ environment :
60+ name : " publish"
7961
8062 steps :
81- - name : Harden the runner (Audit all outbound calls)
82- uses : step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13 .0
63+ - name : " Download dists "
64+ uses : " actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 " # v7.0 .0
8365 with :
84- egress-policy : audit
66+ artifact-ids : ${{ needs.build.outputs.artifact-id }}
67+ path : " dist/"
68+
69+ - name : " Publish dists to PyPI"
70+ uses : " pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e" # v1.13.0
71+ with :
72+ attestations : true
73+
74+ publish-test-pypi :
75+ name : " Publish to Test PyPI"
76+ if : github.event_name == 'workflow_dispatch'
77+ needs : ["build"]
78+ permissions :
79+ id-token : write
80+ runs-on : " ubuntu-latest"
81+ environment :
82+ name : " testpypi"
8583
84+ steps :
8685 - name : " Download dists"
8786 uses : " actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131" # v7.0.0
8887 with :
8988 artifact-ids : ${{ needs.build.outputs.artifact-id }}
9089 path : " dist/"
9190
92- - name : " Publish dists to PyPI"
93- uses : " pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e"
91+ - name : " Publish dists to Test PyPI"
92+ uses : " pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e" # v1.13.0
93+ with :
94+ repository-url : https://test.pypi.org/legacy/
95+ attestations : true
0 commit comments