4
4
push :
5
5
tags :
6
6
- ' **'
7
- branches :
8
- - refactor/refactor-base # remove this once rebuild is merged
9
7
pull_request :
10
8
branches :
11
9
- ' **'
12
10
13
11
concurrency :
14
- # SHA is added to the end if on `main` to let all main workflows run
15
- group : ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
12
+ group : ${{ github.ref }}-${{ github.workflow }}
16
13
cancel-in-progress : true
17
14
18
15
permissions :
@@ -27,26 +24,35 @@ jobs:
27
24
name : Build Mac Installer
28
25
runs-on : macos-latest
29
26
steps :
30
- - uses : Chia-Network/actions/clean-workspace@main
31
-
32
27
- name : Checkout Code
33
28
uses : actions/checkout@v4
34
29
35
30
- name : Setup Node 20
36
31
uses : actions/setup-node@v4
37
32
with :
38
- node-version : ' 20.10 '
33
+ node-version : ' 20.16 '
39
34
40
35
- name : Install Husky
41
36
run : npm install --save-dev husky
42
37
43
38
- name : install dmg-license
44
39
run : npm i dmg-license
45
40
41
+ - name : Change the package.json version if an RC tag
42
+ if : startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
43
+ shell : bash
44
+ run : |
45
+ echo "Github ref: $GITHUB_REF"
46
+ IFS='/' read -r base directory tag <<< "$GITHUB_REF"
47
+ echo "Extracted tag is $tag"
48
+
49
+ jq ".version = \"${tag}\"" package.json > package.tmp
50
+ mv package.tmp package.json
51
+
46
52
- name : npm install
47
53
run : |
48
54
npm install
49
-
55
+
50
56
- name : Test for secrets access
51
57
id : check_secrets
52
58
shell : bash
59
65
SIGNING_SECRET : " ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}"
60
66
61
67
- name : Import Apple installer signing certificate
62
- if : steps.check_secrets.outputs.HAS_SIGNING_SECRET
68
+ if : steps.check_secrets.outputs.HAS_SIGNING_SECRET && startsWith(github.ref, 'refs/tags/')
63
69
uses : Apple-Actions/import-codesign-certs@v1
64
70
with :
65
71
p12-file-base64 : ${{ secrets.APPLE_DEV_ID_APP }}
71
77
run : npm run electron:package:mac
72
78
73
79
- name : Notarize
74
- if : steps.check_secrets.outputs.HAS_SIGNING_SECRET
80
+ if : steps.check_secrets.outputs.HAS_SIGNING_SECRET && startsWith(github.ref, 'refs/tags/')
75
81
run : |
76
82
DMG_FILE=$(find ${{ github.workspace }}/dist/ -type f -name '*.dmg')
77
83
xcrun notarytool submit \
@@ -94,17 +100,26 @@ jobs:
94
100
- name : Checkout Code
95
101
uses : actions/checkout@v4
96
102
97
- - name : Setup Node 20.10
103
+ - name : Setup Node 20.16
98
104
uses : actions/setup-node@v4
99
105
with :
100
- node-version : ' 20.10 '
106
+ node-version : ' 20.16 '
101
107
102
108
- name : Install Husky
103
109
run : npm install --save-dev husky
104
110
105
111
- name : Ignore Husky where not compatible
106
112
run : npm pkg delete scripts.prepare
107
113
114
+ - name : Change the package.json version if an RC tag
115
+ if : startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
116
+ shell : bash
117
+ run : |
118
+ IFS='/' read -r base directory tag <<< "$GITHUB_REF"
119
+
120
+ jq ".version = \"${tag}\"" package.json > package.tmp
121
+ mv package.tmp package.json
122
+
108
123
- name : npm install
109
124
run : |
110
125
node --version
@@ -123,7 +138,7 @@ jobs:
123
138
echo "HAS_SIGNING_SECRET=${HAS_SIGNING_SECRET}" >> "$GITHUB_OUTPUT"
124
139
env :
125
140
SIGNING_SECRET : " ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}"
126
-
141
+
127
142
# Windows Code Signing
128
143
- name : Get installer name for signing
129
144
shell : bash
@@ -155,14 +170,22 @@ jobs:
155
170
- name : Checkout Code
156
171
uses : actions/checkout@v4
157
172
158
- - name : Setup Node 20.10
173
+ - name : Setup Node 20.16
159
174
uses : actions/setup-node@v4
160
175
with :
161
- node-version : ' 20.10 '
176
+ node-version : ' 20.16 '
162
177
163
178
- name : Install Husky
164
179
run : npm install --save-dev husky
165
180
181
+ - name : Change the package.json version if an RC tag
182
+ if : startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
183
+ run : |
184
+ IFS='/' read -r base directory tag <<< "$GITHUB_REF"
185
+
186
+ jq ".version = \"${tag}\"" package.json > package.tmp
187
+ mv package.tmp package.json
188
+
166
189
- name : npm install
167
190
run : |
168
191
node --version
@@ -190,14 +213,22 @@ jobs:
190
213
- name : Checkout Code
191
214
uses : actions/checkout@v4
192
215
193
- - name : Setup Node 20.10
216
+ - name : Setup Node 20.16
194
217
uses : actions/setup-node@v4
195
218
with :
196
- node-version : ' 20.10 '
219
+ node-version : ' 20.16 '
197
220
198
221
- name : Install Husky
199
222
run : npm install --save-dev husky
200
223
224
+ - name : Change the package.json version if an RC tag
225
+ if : startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
226
+ run : |
227
+ IFS='/' read -r base directory tag <<< "$GITHUB_REF"
228
+
229
+ jq ".version = \"${tag}\"" package.json > package.tmp
230
+ mv package.tmp package.json
231
+
201
232
- name : npm install and build
202
233
run : |
203
234
node --version
@@ -258,29 +289,53 @@ jobs:
258
289
echo "EXE_FILE=$EXE_FILE" >>$GITHUB_ENV
259
290
echo "WEB_FILE=$WEB_FILE" >>$GITHUB_ENV
260
291
292
+ # RC release should not be set as latest
293
+ - name : Decide if release should be set as latest
294
+ id : is_latest
295
+ shell : bash
296
+ run : |
297
+ unset IS_LATEST
298
+
299
+ echo "Github ref is $GITHUB_REF"
300
+
301
+ if [[ "$GITHUB_REF" =~ "-rc" ]]; then
302
+ echo "release candidate tag matched"
303
+ IS_LATEST='false'
304
+ IS_PRERELEASE='true'
305
+ else
306
+ echo "main branch release matched"
307
+ IS_LATEST='true'
308
+ IS_PRERELEASE='false'
309
+ fi
310
+
311
+ echo "IS_LATEST=${IS_LATEST}" >> "$GITHUB_OUTPUT"
312
+ echo "IS_PRERELEASE=${IS_PRERELEASE}" >> "$GITHUB_OUTPUT"
313
+
261
314
- name : Release
262
- uses : softprops/action-gh-release@v0.1.15
315
+ uses : softprops/action-gh-release@v2
263
316
with :
317
+ prerelease : ${{steps.is_latest.outputs.IS_PRERELEASE}}
318
+ make_latest : " ${{steps.is_latest.outputs.IS_LATEST}}"
264
319
files : |
265
320
${{ env.DMG_FILE }}
266
321
${{ env.DEB_FILE }}
267
322
${{ env.EXE_FILE }}
268
323
${{ env.WEB_FILE }}
269
324
270
325
- name : Get repo name
326
+ if : startsWith(github.ref, 'refs/tags/') && !contains( github.ref, '-rc')
271
327
id : repo-name
272
328
run : |
273
329
echo "REPO_NAME=$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f 2)" >>$GITHUB_OUTPUT
274
330
275
331
- name : Get tag name
332
+ if : startsWith(github.ref, 'refs/tags/') && !contains( github.ref, '-rc')
276
333
id : tag-name
277
334
run : |
278
335
echo "TAGNAME=$(echo $GITHUB_REF | cut -d / -f 3)" >>$GITHUB_OUTPUT
279
336
280
- - name : Gets JWT Token from GitHub
281
- uses : Chia-Network/actions/github/jwt@main
282
-
283
337
- name : Trigger apt repo update
338
+ if : startsWith(github.ref, 'refs/tags/') && !contains( github.ref, '-rc')
284
339
uses : Chia-Network/actions/github/glue@main
285
340
with :
286
341
json_data : ' {"climate_tokenization_repo":"${{ steps.repo-name.outputs.REPO_NAME }}","application_name":"[\"${{ env.APP_NAME }}\"]","release_version":"${{ steps.tag-name.outputs.TAGNAME }}","add_debian_version":"true","arm64":"available"}'
0 commit comments