@@ -8,17 +8,59 @@ permissions:
88 contents : read
99
1010jobs :
11- release :
11+ build-wheel :
1212 runs-on : ubuntu-latest
13- permissions :
14- id-token : write
1513 steps :
16- - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
14+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1715 with :
1816 persist-credentials : false
19- - uses : astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
17+ - uses : astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
18+
19+ - name : Build wheel
20+ run : uv build --wheel
2021
21- - run : uv build
22+ - name : Upload wheel
23+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
24+ with :
25+ name : dist-wheel
26+ path : dist/*.whl
27+ if-no-files-found : error
28+
29+ build-sdist :
30+ runs-on : ubuntu-latest
31+ steps :
32+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33+ with :
34+ persist-credentials : false
35+ - uses : astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
36+
37+ - name : Build source distribution
38+ run : uv build --sdist
39+
40+ - name : Upload source distribution
41+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
42+ with :
43+ name : dist-sdist
44+ path : dist/*.tar.gz
45+ if-no-files-found : error
46+
47+ lint-dist :
48+ runs-on : ubuntu-latest
49+ needs :
50+ - build-wheel
51+ - build-sdist
52+ steps :
53+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
54+ with :
55+ persist-credentials : false
56+ - uses : astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
57+
58+ - name : Download distributions
59+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
60+ with :
61+ pattern : dist-*
62+ path : dist
63+ merge-multiple : true
2264
2365 - name : Verify wheel install
2466 run : |
@@ -32,19 +74,82 @@ jobs:
3274 source .venv-install-tar/bin/activate
3375 uv pip install dist/*.tar.gz
3476
35- - uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
36- if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
37- with :
38- name : dist
39- path : |
40- dist/*.tar.gz
41- dist/*.whl
77+ - name : Check package metadata
78+ run : uvx twine check dist/*
79+
80+ - name : Check distribution contents
81+ run : uvx pydistcheck --inspect dist/*
4282
43- - run : uvx twine check dist/*
44- - run : uvx pydistcheck --inspect dist/*
45- - run : uvx pyroma dist/*.tar.gz
46- - run : uvx check-wheel-contents dist/*.whl
47- - run : uvx check-manifest -v
83+ - name : Check source metadata
84+ run : uvx pyroma dist/*.tar.gz
4885
49- - if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
86+ - name : Check wheel contents
87+ run : uvx check-wheel-contents dist/*.whl
88+
89+ - name : Check source manifest
90+ run : uvx check-manifest -v
91+
92+ publish-pypi :
93+ runs-on : ubuntu-latest
94+ needs : lint-dist
95+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
96+ permissions :
97+ id-token : write
98+ steps :
99+ - uses : astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
100+
101+ - name : Download distributions
102+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
103+ with :
104+ pattern : dist-*
105+ path : dist
106+ merge-multiple : true
107+
108+ - name : Publish to PyPI
50109 run : uv publish --trusted-publishing always
110+
111+ publish-github-release :
112+ runs-on : ubuntu-latest
113+ needs : lint-dist
114+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
115+ permissions :
116+ contents : write
117+ steps :
118+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
119+ with :
120+ persist-credentials : false
121+
122+ - name : Download distributions
123+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
124+ with :
125+ pattern : dist-*
126+ path : dist
127+ merge-multiple : true
128+
129+ - name : Extract release notes
130+ env :
131+ TAG_NAME : ${{ github.ref_name }}
132+ run : |
133+ version="${TAG_NAME#v}"
134+ awk -v version="$version" '
135+ index($0, "## [" version "]") == 1 { in_section = 1; next }
136+ in_section && /^## / { exit }
137+ in_section { print }
138+ ' CHANGELOG.md > release-notes.md
139+ sed -i '1{/^$/d;}' release-notes.md
140+ if ! grep -q '[^[:space:]]' release-notes.md; then
141+ echo "No CHANGELOG.md section found for ${version}" >&2
142+ exit 1
143+ fi
144+
145+ - name : Update GitHub release notes
146+ env :
147+ GH_TOKEN : ${{ github.token }}
148+ TAG_NAME : ${{ github.ref_name }}
149+ run : gh release edit "$TAG_NAME" --notes-file release-notes.md
150+
151+ - name : Upload GitHub release assets
152+ env :
153+ GH_TOKEN : ${{ github.token }}
154+ TAG_NAME : ${{ github.ref_name }}
155+ run : gh release upload "$TAG_NAME" dist/*.whl dist/*.tar.gz --clobber
0 commit comments