1
1
name : Python CI
2
2
3
3
" on " :
4
+ merge_group : {}
4
5
push :
5
6
branches-ignore :
6
7
# These should always correspond to pull requests, so ignore them for
@@ -11,9 +12,9 @@ name: Python CI
11
12
- " renovate/**"
12
13
- " tickets/**"
13
14
- " u/**"
14
- tags :
15
- - " *"
16
15
pull_request : {}
16
+ release :
17
+ types : [published]
17
18
18
19
jobs :
19
20
lint :
37
38
strategy :
38
39
matrix :
39
40
python :
40
- - " 3.8"
41
- - " 3.9"
42
41
- " 3.10"
43
42
- " 3.11"
44
43
@@ -81,22 +80,48 @@ jobs:
81
80
username : ${{ secrets.LTD_USERNAME }}
82
81
password : ${{ secrets.LTD_PASSWORD }}
83
82
if : >
84
- github.event_name != 'pull_request'
85
- || startsWith(github.head_ref, 'tickets/')
83
+ github.event_name != 'merge_group'
84
+ && (github.event_name != 'pull_request'
85
+ || startsWith(github.head_ref, 'tickets/'))
86
+
87
+ test-packaging :
88
+
89
+ name : Test packaging
90
+ runs-on : ubuntu-latest
91
+
92
+ steps :
93
+ - uses : actions/checkout@v3
94
+ with :
95
+ fetch-depth : 0 # full history for setuptools_scm
96
+
97
+ - name : Build and publish
98
+ uses : lsst-sqre/build-and-publish-to-pypi@v2
99
+ with :
100
+ python-version : " 3.11"
101
+ upload : false
86
102
87
103
pypi :
88
104
105
+ # This job requires set up:
106
+ # 1. Set up a trusted publisher for PyPI
107
+ # 2. Set up a "pypi" environment in the repository
108
+ # See https://github.com/lsst-sqre/build-and-publish-to-pypi
109
+ name : Upload release to PyPI
89
110
runs-on : ubuntu-latest
90
- needs : [lint, test, docs]
111
+ needs : [lint, test, docs, test-packaging]
112
+ environment :
113
+ name : pypi
114
+ url : https://pypi.org/p/kafkit
115
+ permissions :
116
+ id-token : write
117
+ if : github.event_name == 'release' && github.event.action == 'published'
91
118
92
119
steps :
93
120
- uses : actions/checkout@v3
94
121
with :
95
122
fetch-depth : 0 # full history for setuptools_scm
96
123
97
124
- name : Build and publish
98
- uses : lsst-sqre/build-and-publish-to-pypi@v1
125
+ uses : lsst-sqre/build-and-publish-to-pypi@v2
99
126
with :
100
- pypi-token : ${{ secrets.PYPI_SQRE_ADMIN }}
101
127
python-version : " 3.11"
102
- upload : ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
0 commit comments