@@ -2,7 +2,7 @@ name: Publish Python Package
22
33on :
44 push :
5- branches : [main, wip ]
5+ branches : [main]
66 workflow_dispatch :
77
88jobs :
@@ -30,14 +30,75 @@ jobs:
3030 with :
3131 name : python-packages
3232 path : dist/
33+
34+ publish-to-pypi :
35+ name : Publish to PyPI
36+ if : startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
37+ runs-on : ubuntu-24.04
38+ needs : [build]
39+ environment :
40+ name : pypi
41+ url : https://pypi.org/p/simplefin
42+ permissions :
43+ id-token : write
44+ steps :
45+ - name : Download distribution packages
46+ uses : actions/download-artifact@v4
47+ with :
48+ name : python-packages
49+ path : dist/
50+ - name : Publish to PyPI
51+ uses : pypa/gh-action-pypi-publish@release/v1
52+ with :
53+ verbose : true
54+
55+ github-release :
56+ name : Create GitHub Release
57+ needs : publish-to-pypi
58+ runs-on : ubuntu-24.04
59+
60+ permissions :
61+ contents : write
62+ id-token : write
63+
64+ steps :
65+ - name : Download distribution packages
66+ uses : actions/download-artifact@v4
67+ with :
68+ name : python-packages
69+ path : dist/
70+ - name : Sign the dists with Sigstore
71+ uses : sigstore/gh-action-sigstore-python@v3.0.0
72+ with :
73+ inputs : >-
74+ ./dist/*.tar.gz
75+ ./dist/*.whl
76+ - name : Create GitHub Release
77+ env :
78+ GITHUB_TOKEN : ${{ github.token }}
79+ run : >-
80+ gh release create
81+ "$GITHUB_REF_NAME"
82+ --repo "$GITHUB_REPOSITORY"
83+ --notes ""
84+ - name : Upload artifact signatures to GitHub Release
85+ env :
86+ GITHUB_TOKEN : ${{ github.token }}
87+ # Upload to GitHub Release using the `gh` CLI.
88+ # `dist/` contains the built packages, and the
89+ # sigstore-produced signatures and certificates.
90+ run : >-
91+ gh release upload
92+ "$GITHUB_REF_NAME" dist/**
93+ --repo "$GITHUB_REPOSITORY"
3394
3495 publish-to-testpypi :
3596 name : Publish to PyPI-Test
3697 runs-on : ubuntu-24.04
3798 needs : [build]
3899 environment :
39100 name : testpypi
40- url : https://test.pypi.org/p/simplefin-python
101+ url : https://test.pypi.org/p/simplefin
41102 permissions :
42103 id-token : write
43104 steps :
46107 with :
47108 name : python-packages
48109 path : dist/
49- - name : Publish to PyPI
110+ - name : Publish to TestPyPI
50111 uses : pypa/gh-action-pypi-publish@release/v1
51112 with :
52113 repository-url : https://test.pypi.org/legacy/
0 commit comments