Skip to content

Commit 9ec97df

Browse files
committed
CI: add a PyPI publishing workflow
1 parent 34bf131 commit 9ec97df

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: CD
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
release:
10+
types:
11+
- published
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
# Many color libraries just need this to be set to any value, but at least
19+
# one distinguishes color depth, where "3" -> "256-bit color".
20+
FORCE_COLOR: 3
21+
22+
jobs:
23+
dist:
24+
name: Distribution build
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- uses: actions/checkout@v6
29+
with:
30+
fetch-depth: 0
31+
32+
- uses: hynek/build-and-inspect-python-package@v2
33+
34+
publish:
35+
needs: [dist]
36+
name: Publish to PyPI
37+
environment: pypi
38+
permissions:
39+
id-token: write
40+
attestations: write
41+
contents: read
42+
runs-on: ubuntu-latest
43+
if: github.event_name == 'release' && github.event.action == 'published'
44+
45+
steps:
46+
- uses: actions/download-artifact@v7
47+
with:
48+
name: Packages
49+
path: dist
50+
51+
- name: Generate artifact attestation for sdist and wheel
52+
uses: actions/attest-build-provenance@v3
53+
with:
54+
subject-path: "dist/*"
55+
56+
- uses: pypa/gh-action-pypi-publish@release/v1
57+
with:
58+
packages-dir: ./dist/

0 commit comments

Comments
 (0)