File tree 1 file changed +48
-8
lines changed
1 file changed +48
-8
lines changed Original file line number Diff line number Diff line change 13
13
required : true
14
14
15
15
jobs :
16
- deploy :
17
-
16
+ release-build :
18
17
runs-on : ubuntu-latest
19
-
18
+ permissions :
19
+ issues : write
20
20
steps :
21
21
- uses : actions/checkout@v4
22
22
with :
@@ -40,13 +40,15 @@ jobs:
40
40
VERSION=${VERSION#v}
41
41
echo "VERSION=$VERSION" >> $GITHUB_ENV
42
42
python tools/update_version.py $VERSION
43
- - name : Build and publish
44
- env :
45
- TWINE_USERNAME : ${{ secrets.PYPI_API_USER }}
46
- TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
43
+ - name : Build
47
44
run : |
48
45
python setup.py sdist bdist_wheel
49
- twine upload dist/*
46
+
47
+ - name : upload artifact
48
+ uses : actions/upload-artifact@v4
49
+ with :
50
+ name : release-dists
51
+ path : dist/
50
52
51
53
- name : Create GitHub Issue on Failure
52
54
if : failure()
66
68
body: issueBody,
67
69
assignees
68
70
});
71
+
72
+ pypi-publish :
73
+ runs-on : ubuntu-latest
74
+ needs :
75
+ - release-build
76
+ environment :
77
+ name : release
78
+ permissions :
79
+ id-token : write
80
+ issues : write
81
+
82
+ steps :
83
+ - name : Retrieve release distributions
84
+ uses : actions/download-artifact@v4
85
+ with :
86
+ name : release-dists
87
+ path : dist/
88
+
89
+ - name : Publish release distributions to PyPI
90
+ uses : pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
91
+
92
+ - name : Create GitHub Issue on Failure
93
+ if : failure()
94
+ uses : actions/github-script@v7
95
+ with :
96
+ script : |
97
+ const { owner, repo } = context.repo;
98
+ const issueTitle = `Release job for failed`;
99
+ const issueBody = `The release job failed. Please check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.`;
100
+ const assignees = [context.actor];
101
+
102
+ await github.rest.issues.create({
103
+ owner,
104
+ repo,
105
+ title: issueTitle,
106
+ body: issueBody,
107
+ assignees
108
+ });
You can’t perform that action at this time.
0 commit comments