@@ -20,20 +20,6 @@ concurrency:
2020 cancel-in-progress : true
2121
2222jobs :
23- dist :
24- permissions :
25- id-token : write
26- attestations : write
27- uses : ./.github/workflows/pypi-package.yml
28- with :
29- deploy :
30- ${{ (github.event_name == 'release' && github.event.action ==
31- ' published' ) || (github.event_name == 'workflow_dispatch' &&
32- inputs.deploy) }}
33- check-package :
34- github.event_name == 'release' && github.event.action == 'published'
35- smoke-test : false
36-
3723 docs :
3824 permissions :
3925 contents : write
@@ -43,3 +29,130 @@ jobs:
4329 ${{ (github.event_name == 'release' && github.event.action ==
4430 ' published' ) || (github.event_name == 'workflow_dispatch' &&
4531 inputs.deploy) }}
32+
33+ # would like to do this with a reusable workflow
34+ # see https://github.com/pypa/gh-action-pypi-publish/issues/166
35+ # dist:
36+ # permissions:
37+ # id-token: write
38+ # attestations: write
39+ # uses: ./.github/workflows/pypi-package.yml
40+ # with:
41+ # deploy:
42+ # ${{ (github.event_name == 'release' && github.event.action ==
43+ # 'published') || (github.event_name == 'workflow_dispatch' &&
44+ # inputs.deploy) }}
45+ # check-package:
46+ # ${{ github.event_name == 'release' && github.event.action == 'published'
47+ # }}
48+ # smoke-test: false
49+ dist :
50+ name : Build and verify package
51+ runs-on : ubuntu-latest
52+ env :
53+ DIST : " /tmp/baipp/dist"
54+ permissions :
55+ id-token : write
56+ attestations : write
57+
58+ steps :
59+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
60+ with :
61+ persist-credentials : false
62+ - uses : hynek/build-and-inspect-python-package@efb823f52190ad02594531168b7a2d5790e66516 # v2.14.0
63+ with :
64+ attest-build-provenance-github : " true"
65+
66+ - name : Check no changelog fragments
67+ if : github.event_name == 'release' && github.event.action == 'published'
68+ run : |
69+ shopt -s nullglob
70+ for _ in changelog.d/*.md ; do
71+ echo "Error: changelog snippets found"
72+ exit 1
73+ done
74+ echo "Success: no changelog snippets"
75+ shell : bash
76+
77+ - name : Check version
78+ if : github.event_name == 'release' && github.event.action == 'published'
79+ env :
80+ tag_name : ${{ github.event.release.tag_name }}
81+ run : >-
82+ uv run --script tools/check_dist_version.py --version "$tag_name" --
83+ "${DIST}"/*.whl "${DIST}"/*.tar.gz
84+
85+ smoke-test :
86+ name : Smoke test package
87+ if :
88+ ${{ (github.event_name == 'release' && github.event.action == 'published')
89+ || (github.event_name == 'workflow_dispatch' && inputs.deploy) }}
90+ needs :
91+ - dist
92+ runs-on : ubuntu-latest
93+ permissions : {}
94+ steps :
95+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
96+ with :
97+ persist-credentials : false
98+ - uses : actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
99+ with :
100+ name : Packages
101+ path : dist
102+ - uses : ./.github/actions/setup-cached-uv-and-python
103+ with :
104+ python-version-file : " .python-version"
105+ - name : Smoke test wheel
106+ run :
107+ uv run --isolated --no-project --with dist/*.whl tests/test_smoke.py
108+ - name : Smoke test source
109+ run :
110+ uv run --isolated --no-project --with dist/*.tar.gz
111+ tests/test_smoke.py
112+
113+ publish-testpypi :
114+ name : Publish package to testpypi
115+ if :
116+ ${{ (github.event_name == 'release' && github.event.action == 'published')
117+ || (github.event_name == 'workflow_dispatch' && inputs.deploy) }}
118+ needs :
119+ - dist
120+ - smoke-test
121+ environment :
122+ name : test-pypi
123+ permissions :
124+ id-token : write
125+ runs-on : ubuntu-latest
126+ steps :
127+ - uses : actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
128+ with :
129+ name : Packages
130+ path : dist
131+
132+ - name : Publish to testpypi
133+ uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
134+ with :
135+ repository-url : https://test.pypi.org/legacy/
136+
137+ publish-pypi :
138+ name : Publish package to pypi
139+ if :
140+ ${{ (github.event_name == 'release' && github.event.action == 'published')
141+ || (github.event_name == 'workflow_dispatch' && inputs.deploy) }}
142+ needs :
143+ - dist
144+ - smoke-test
145+ - publish-testpypi
146+ environment :
147+ name : pypi
148+ permissions :
149+ id-token : write
150+ runs-on : ubuntu-latest
151+ steps :
152+ - uses : actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
153+ with :
154+ name : Packages
155+ path : dist
156+
157+ - name : Publish to pypi
158+ uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
0 commit comments