1
+ name : Publish to PyPI
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - ' v*'
7
+ - ' v*.*.*'
8
+
9
+ jobs :
10
+ build :
11
+ name : Build distribution
12
+ runs-on : ubuntu-latest
13
+
14
+ steps :
15
+ - uses : actions/checkout@v4
16
+
17
+ - name : Set up Python
18
+ uses : actions/setup-python@v5
19
+ with :
20
+ python-version : ' 3.13'
21
+
22
+ - name : Install pypa/build
23
+ run : python -m pip install build
24
+
25
+ - name : Build a binary wheel and a source tarball
26
+ run : python -m build
27
+
28
+ - name : Store the distribution packages
29
+ uses : actions/upload-artifact@v4
30
+ with :
31
+ name : python-package-distributions
32
+ path : dist/
33
+
34
+ publish-to-pypi :
35
+ name : Publish to PyPI
36
+ needs :
37
+ - build
38
+ runs-on : ubuntu-latest
39
+ environment :
40
+ name : pypi
41
+ url : https://pypi.org/p/divine-thegraph-token-api
42
+ permissions :
43
+ id-token : write # IMPORTANT: this permission is mandatory for trusted publishing
44
+
45
+ steps :
46
+ - name : Download all the dists
47
+ uses : actions/download-artifact@v4
48
+ with :
49
+ name : python-package-distributions
50
+ path : dist/
51
+
52
+ - name : Publish distribution to PyPI
53
+ uses : pypa/gh-action-pypi-publish@release/v1
54
+
55
+ github-release :
56
+ name : Create GitHub Release
57
+ needs :
58
+ - publish-to-pypi
59
+ runs-on : ubuntu-latest
60
+
61
+ permissions :
62
+ contents : write # IMPORTANT: this permission is mandatory for creating releases
63
+ id-token : write
64
+
65
+ steps :
66
+ - name : Download all the dists
67
+ uses : actions/download-artifact@v4
68
+ with :
69
+ name : python-package-distributions
70
+ path : dist/
71
+
72
+ - name : Sign the dists with Sigstore
73
+
74
+ with :
75
+ inputs : >-
76
+ ./dist/*.tar.gz
77
+ ./dist/*.whl
78
+
79
+ - name : Create GitHub Release
80
+ env :
81
+ GITHUB_TOKEN : ${{ github.token }}
82
+ run : >-
83
+ gh release create
84
+ '${{ github.ref_name }}'
85
+ --repo '${{ github.repository }}'
86
+ --notes ""
87
+
88
+ - name : Upload artifact signatures to GitHub Release
89
+ env :
90
+ GITHUB_TOKEN : ${{ github.token }}
91
+ run : >-
92
+ gh release upload
93
+ '${{ github.ref_name }}' dist/**
94
+ --repo '${{ github.repository }}'
0 commit comments