16
16
concurrency : release
17
17
if : github.repository == 'darvid/python-hyperscan'
18
18
permissions :
19
- contents : write
20
- issues : write
21
- pull-requests : write
22
19
id-token : write
20
+ pull-requests : write
21
+ contents : write
23
22
env :
24
23
RELEASE_PR_BRANCH : create-pull-request/patch
25
24
steps :
@@ -31,34 +30,61 @@ jobs:
31
30
32
31
- uses : chainguard-dev/actions/setup-gitsign@main
33
32
34
- - name : Setup Node.js
35
- uses : actions/setup-node@v3
33
+ - name : Check if release needed
34
+ id : release
35
+ uses : python-semantic-release/python-semantic-release@v8.7.2
36
36
with :
37
- node-version : " lts/*"
38
-
39
- - name : Install semantic-release dependencies
40
- run : npm clean-install
37
+ github_token : ${{ secrets.GITHUB_TOKEN }}
38
+ root_options : " -vv --noop"
39
+ # python-semantic-release displays what it would have
40
+ # committed if commit is true and noop is set
41
+ commit : " true"
41
42
42
43
- name : Download artifacts
43
44
uses : actions/download-artifact@v4
44
- if : github.event_name == 'workflow_dispatch'
45
+ if : github.event_name == 'workflow_dispatch' || steps.release.outputs.released == 'true'
45
46
46
47
- name : Prepare dist
47
- if : github.event_name == 'workflow_dispatch'
48
+ if : github.event_name == 'workflow_dispatch' || steps.release.outputs.released == 'true'
48
49
run : |
49
50
mkdir dist
50
51
mv --backup=numbered ./wheel-*/*.whl -t dist/
51
52
mv --backup=numbered ./sdist/*.tar.gz -t dist/
52
53
ls -ahl dist/
53
54
rm -rf dist/*~
54
55
55
- - name : Set up Python
56
- uses : actions/setup-python@v4
56
+ - name : Create release branch
57
+ if : steps.release.outputs.released == 'true'
58
+ run : |
59
+ # use the same default branch name that create-pull-request uses
60
+ git checkout -b ${RELEASE_PR_BRANCH}
61
+ git branch --set-upstream-to=${RELEASE_PR_BRANCH}
62
+
63
+ - name : Semantic release
64
+ uses : python-semantic-release/python-semantic-release@v8.7.2
65
+ if : steps.release.outputs.released == 'true'
66
+ with :
67
+ github_token : ${{ secrets.GITHUB_TOKEN }}
68
+ root_options : " -vv"
69
+
70
+ - name : Create PR
71
+ uses : peter-evans/create-pull-request@v4.0.2
72
+ if : steps.release.outputs.released == 'true'
57
73
with :
58
- python-version : 3.12
74
+ base : main
75
+ assignees : ${{ github.repository_owner }}
76
+ title : " Release ${{ steps.release.outputs.version }}"
59
77
60
- - name : Release
61
- env :
62
- GH_TOKEN : ${{ secrets.GH_TOKEN }}
63
- PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
64
- run : npx semantic-release
78
+ - name : Publish package distributions to GitHub Releases
79
+ if : github.event_name == 'workflow_dispatch' || steps.release.outputs.released == 'true'
80
+ uses : python-semantic-release/upload-to-gh-release@main
81
+ with :
82
+ github_token : ${{ secrets.GITHUB_TOKEN }}
83
+ tag : ${{ steps.release.outputs.tag }}
84
+
85
+ - name : Publish package distributions to PyPI
86
+ if : github.event_name == 'workflow_dispatch' || steps.release.outputs.released == 'true'
87
+ uses : pypa/gh-action-pypi-publish@release/v1
88
+ with :
89
+ skip-existing : true
90
+ verbose : true
0 commit comments