Skip to content

Commit bc21052

Browse files
authored
ci: add release workflow (#120)
* ci: add release workflow * Update .github/workflows/release.yml
1 parent 221963e commit bc21052

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
packages:
15+
permissions:
16+
attestations: write
17+
id-token: write
18+
contents: read
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- run: pip install build==1.2.1
24+
25+
- run: python -m build
26+
27+
- name: generate build provenance
28+
uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
29+
with:
30+
subject-path: "${{ github.workspace }}/dist/*"
31+
32+
- name: Upload Packages
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: packages
36+
path: |
37+
dist/*.whl
38+
dist/*tar.gz
39+
40+
publish-pypi:
41+
needs:
42+
- packages
43+
runs-on: ubuntu-latest
44+
environment: release
45+
permissions:
46+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
47+
steps:
48+
- uses: actions/download-artifact@v4
49+
with:
50+
name: packages
51+
path: dist
52+
53+
- name: Upload pypi.org
54+
if: startsWith(github.ref, 'refs/tags')
55+
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0
56+
with:
57+
repository-url: https://upload.pypi.org/legacy/

0 commit comments

Comments
 (0)