1
1
name : Python Wheels
2
2
3
- on : [push, pull_request]
3
+ on :
4
+ push :
5
+ tags :
6
+ - " [0-9]+.[0-9]+.[0-9]+"
7
+ - " [0-9]+.[0-9]+.[0-9]+.post[0-9]+"
8
+ - " [0-9]+.[0-9]+.[0-9]+[a-b][0-9]+"
9
+ - " [0-9]+.[0-9]+.[0-9]+rc[0-9]+"
10
+ workflow_dispatch :
11
+ pull_request :
4
12
5
13
concurrency :
6
14
group : release-${{ github.ref }}
@@ -43,18 +51,36 @@ jobs:
43
51
name : " sdist"
44
52
path : dist/*.zip
45
53
46
- collect_wheels :
54
+ collect_dist :
47
55
runs-on : ubuntu-latest
48
56
needs : [build_wheels, make_sdist]
49
57
name : Download Wheels
50
58
steps :
51
59
- name : Download all workflow run artifacts
52
- uses : actions/download-artifact@v2
60
+ uses : actions/download-artifact@v3
53
61
- name : Flatten directory
62
+ working-directory : .
54
63
run : |
55
64
find . -mindepth 2 -type f -exec mv {} . \;
56
65
find . -type d -empty -delete
57
- - uses : actions/upload-artifact@v2
66
+ - uses : actions/upload-artifact@v3
58
67
with :
59
- name : all-dist
68
+ name : all-dist-${{ github.head_ref || github.ref_name }}
60
69
path : " ./*"
70
+
71
+ publish :
72
+ # https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#publishing-the-distribution-to-pypi
73
+ needs : [collect_dist]
74
+ if : startsWith(github.ref, 'refs/tags/')
75
+ runs-on : ubuntu-latest
76
+ environment : release
77
+ permissions :
78
+ id-token : write
79
+ steps :
80
+ - name : Download all the dists
81
+ uses : actions/download-artifact@v3
82
+ with :
83
+ name : all-dist-${{ github.head_ref || github.ref_name }}
84
+ path : dist/
85
+ - name : Publish distribution 📦 to PyPI
86
+ uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments