1
1
name : " Publish new release"
2
2
3
3
on :
4
+ workflow_dispatch :
4
5
push :
5
6
tags :
6
7
- v[0-9]+.*
@@ -14,78 +15,59 @@ jobs:
14
15
packaging :
15
16
name : Build wheels on ${{ matrix.os }}
16
17
runs-on : ${{ matrix.os }}
17
- if : startsWith(github.ref, 'refs/tags/') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
18
+ if : startsWith(github.ref, 'refs/tags/') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || github.event_name == 'workflow_dispatch'
18
19
strategy :
19
20
matrix :
20
- os : [ubuntu-20.04, windows-2019, macos-10.15]
21
+ os :
22
+ - ubuntu-latest
21
23
22
24
steps :
23
25
- uses : actions/checkout@v2
26
+ if : github.event_name != 'workflow_dispatch'
27
+
28
+ - uses : actions/checkout@v2
29
+ if : github.event_name == 'workflow_dispatch'
30
+ with :
31
+ ref : ' master'
24
32
25
33
- name : Get history and tags for SCM versioning to work
26
34
run : |
27
35
git fetch --prune --unshallow
28
36
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
29
37
30
- - name : Extract version from tag name (Unix)
31
- if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && runner.os != 'Windows'
32
- run : |
33
- TAG_NAME="${GITHUB_REF/refs\/tags\//}"
34
- VERSION=${TAG_NAME#v}
35
-
36
- echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
38
+ # ========================================================================
37
39
38
40
- name : Extract version from branch name (for release branches) (Unix)
39
41
if : github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'release/') && runner.os != 'Windows'
40
42
run : |
41
43
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
42
44
VERSION=${BRANCH_NAME#release/}
43
-
44
- echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
45
- git tag v${RELEASE_VERSION} master
45
+ git tag v${VERSION} master
46
46
47
47
- name : Extract version from branch name (for hotfix branches) (Unix)
48
48
if : github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'hotfix/') && runner.os != 'Windows'
49
49
run : |
50
50
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
51
51
VERSION=${BRANCH_NAME#hotfix/}
52
+ git tag v${VERSION} master
52
53
53
- echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
54
- git tag v${RELEASE_VERSION} master
55
-
56
-
57
- - name : Extract version from tag name (Windows)
58
- if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && runner.os == 'Windows'
59
- run : |
60
- $TAG_NAME = $GITHUB_REF -replace "refs/tags/",""
61
- $VERSION = $TAG_NAME -replace "v",""
62
-
63
- Write-Output "RELEASE_VERSION=$VERSION" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
54
+ # ------------------------------------------------------------------------
64
55
65
56
- name : Extract version from branch name (for release branches) (Windows)
66
57
if : github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'release/') && runner.os == 'Windows'
67
58
run : |
68
59
$BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
69
60
$VERSION = $BRANCH_NAME -replace "release/",""
61
+ git tag v${VERSION} master
70
62
71
- Write-Output "RELEASE_VERSION=$VERSION" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
72
- git tag v${RELEASE_VERSION} master
73
-
74
- - name : Extract version from branch name (for hotfix branches) (Unix)
63
+ - name : Extract version from branch name (for hotfix branches) (Windows)
75
64
if : github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'hotfix/') && runner.os == 'Windows'
76
65
run : |
77
66
$BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
78
67
$VERSION = $BRANCH_NAME -replace "hotfix/",""
68
+ git tag v${VERSION} master
79
69
80
- Write-Output "RELEASE_VERSION=$VERSION" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
81
- git tag v${RELEASE_VERSION} master
82
-
83
- - name : Build wheels
84
-
85
- env :
86
- CIBW_ARCHS : auto64
87
- CIBW_SKIP : cp27-* pp* cp35-*
88
- CIBW_BEFORE_BUILD : python -m pip install pybind11
70
+ # ========================================================================
89
71
90
72
- name : Build source distribution
91
73
if : runner.os == 'Linux'
@@ -101,11 +83,21 @@ jobs:
101
83
name : packages
102
84
path : ./wheelhouse/*
103
85
86
+
104
87
release :
105
88
name : Publish new release
106
89
runs-on : ubuntu-latest
107
- needs : packaging
90
+ needs :
91
+ - packaging
108
92
steps :
93
+ - name : Extract version from tag name (workflow_dispatch)
94
+ if : github.event_name == 'workflow_dispatch'
95
+ run : |
96
+ TAG_NAME=$(git describe --tags `git rev-list --tags --max-count=1`)
97
+ VERSION=${TAG_NAME#v}
98
+
99
+ echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
100
+
109
101
- name : Extract version from tag name
110
102
if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
111
103
run : |
@@ -130,8 +122,18 @@ jobs:
130
122
131
123
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
132
124
125
+ # ------------------------------------------------------------------------
126
+ # Checkout repository to get CHANGELOG
127
+
133
128
- uses : actions/checkout@v2
129
+ if : github.event_name != 'workflow_dispatch'
130
+
131
+ - uses : actions/checkout@v2
132
+ if : github.event_name == 'workflow_dispatch'
133
+ with :
134
+ ref : ' master'
134
135
136
+ # ------------------------------------------------------------------------
135
137
# Downloads all to directories matching the artifact names
136
138
- uses : actions/download-artifact@v2
137
139
@@ -164,7 +166,7 @@ jobs:
164
166
upload_to_pypi :
165
167
name : Upload to PyPI
166
168
runs-on : ubuntu-latest
167
- needs : release # Only upload to PyPi if everything was successful
169
+ needs : release
168
170
steps :
169
171
- uses : actions/setup-python@v2
170
172
@@ -181,7 +183,9 @@ jobs:
181
183
master_to_develop_pr :
182
184
name : Merge master back into develop
183
185
runs-on : ubuntu-latest
184
- needs : release # Only create PR if everything was successful
186
+ needs :
187
+ - release
188
+ - upload_to_pypi
185
189
steps :
186
190
- name : Merge master into develop branch
187
191
uses :
thomaseizinger/[email protected]
0 commit comments