1+ name : Publish to PyPI
2+
3+ on :
4+ release :
5+ types : [published]
6+
7+ jobs :
8+ build :
9+ name : Build distribution 📦
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - uses : actions/checkout@v4
14+ - name : Set up Python
15+ uses : actions/setup-python@v4
16+ with :
17+ python-version : " 3.x"
18+ - name : Install poetry
19+ uses : abatilo/actions-poetry@v2
20+ - name : Configure poetry
21+ run : poetry config virtualenvs.create false
22+ - name : Install dependencies
23+ run : poetry install --only=main
24+ - name : Build package
25+ run : poetry build
26+ - name : Store the distribution packages
27+ uses : actions/upload-artifact@v3
28+ with :
29+ name : python-package-distributions
30+ path : dist/
31+
32+ publish-to-pypi :
33+ name : >-
34+ Publish Python 🐍 distribution 📦 to PyPI
35+ if : startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
36+ needs :
37+ - build
38+ runs-on : ubuntu-latest
39+ environment :
40+ name : pypi
41+ url : https://pypi.org/p/structure-align
42+ permissions :
43+ id-token : write
44+
45+ steps :
46+ - name : Download all the dists
47+ uses : actions/download-artifact@v3
48+ with :
49+ name : python-package-distributions
50+ path : dist/
51+ - name : Publish distribution 📦 to PyPI
52+ uses : pypa/gh-action-pypi-publish@release/v1
53+
54+ github-release :
55+ name : >-
56+ Sign the Python 🐍 distribution 📦 with Sigstore
57+ and upload them to GitHub Release
58+ needs :
59+ - publish-to-pypi
60+ runs-on : ubuntu-latest
61+
62+ permissions :
63+ contents : write
64+ id-token : write
65+
66+ steps :
67+ - name : Download all the dists
68+ uses : actions/download-artifact@v3
69+ with :
70+ name : python-package-distributions
71+ path : dist/
72+ - name : Sign the dists with Sigstore
73+ uses : sigstore/gh-action-sigstore-python@v1.2.3
74+ with :
75+ inputs : >-
76+ ./dist/*.tar.gz
77+ ./dist/*.whl
78+ - name : Create GitHub Release
79+ env :
80+ GITHUB_TOKEN : ${{ github.token }}
81+ run : >-
82+ gh release upload
83+ '${{ github.ref_name }}' dist/**
84+ --repo '${{ github.repository }}'
0 commit comments