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,15 +24,24 @@ 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'
34
+
35
+ - name : Change the package.json version if an RC tag
36
+ if : startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
37
+ shell : bash
38
+ run : |
39
+ echo "Github ref: $GITHUB_REF"
40
+ IFS='/' read -r base directory tag <<< "$GITHUB_REF"
41
+ echo "Extracted tag is $tag"
42
+
43
+ jq ".version = \"${tag}\"" package.json > package.tmp
44
+ mv package.tmp package.json
39
45
40
46
- name : Install Husky
41
47
run : npm install --save-dev husky
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@v3
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,10 +100,19 @@ 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'
107
+
108
+ - name : Change the package.json version if an RC tag
109
+ if : startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
110
+ shell : bash
111
+ run : |
112
+ IFS='/' read -r base directory tag <<< "$GITHUB_REF"
113
+
114
+ jq ".version = \"${tag}\"" package.json > package.tmp
115
+ mv package.tmp package.json
101
116
102
117
- name : Install Husky
103
118
run : npm install --save-dev husky
@@ -155,10 +170,19 @@ 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'
177
+
178
+ - name : Change the package.json version if an RC tag
179
+ if : startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
180
+ shell : bash
181
+ run : |
182
+ IFS='/' read -r base directory tag <<< "$GITHUB_REF"
183
+
184
+ jq ".version = \"${tag}\"" package.json > package.tmp
185
+ mv package.tmp package.json
162
186
163
187
- name : Install Husky
164
188
run : npm install --save-dev husky
@@ -190,10 +214,19 @@ jobs:
190
214
- name : Checkout Code
191
215
uses : actions/checkout@v4
192
216
193
- - name : Setup Node 20.10
217
+ - name : Setup Node 20.16
194
218
uses : actions/setup-node@v4
195
219
with :
196
- node-version : ' 20.10'
220
+ node-version : ' 20.16'
221
+
222
+ - name : Change the package.json version if an RC tag
223
+ if : startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
224
+ shell : bash
225
+ run : |
226
+ IFS='/' read -r base directory tag <<< "$GITHUB_REF"
227
+
228
+ jq ".version = \"${tag}\"" package.json > package.tmp
229
+ mv package.tmp package.json
197
230
198
231
- name : Install Husky
199
232
run : npm install --save-dev husky
@@ -258,29 +291,52 @@ jobs:
258
291
echo "EXE_FILE=$EXE_FILE" >>$GITHUB_ENV
259
292
echo "WEB_FILE=$WEB_FILE" >>$GITHUB_ENV
260
293
294
+ # RC release should not be set as latest
295
+ - name : Decide if release should be set as latest
296
+ id : is_latest
297
+ shell : bash
298
+ run : |
299
+ unset IS_LATEST
300
+
301
+ echo "Github ref is $GITHUB_REF"
302
+
303
+ if [[ "$GITHUB_REF" =~ "-rc" ]]; then
304
+ echo "release candidate tag matched"
305
+ IS_LATEST='false'
306
+ IS_PRERELEASE='true'
307
+ else
308
+ echo "main branch release matched"
309
+ IS_LATEST='true'
310
+ IS_PRERELEASE='false'
311
+ fi
312
+
313
+ echo "IS_LATEST=${IS_LATEST}" >> "$GITHUB_OUTPUT"
314
+ echo "IS_PRERELEASE=${IS_PRERELEASE}" >> "$GITHUB_OUTPUT"
315
+
261
316
- name : Release
262
- uses : softprops/action-gh-release@v2.1.0
317
+ uses : softprops/action-gh-release@v2
263
318
with :
319
+ prerelease : ${{steps.is_latest.outputs.IS_PRERELEASE}}
320
+ make_latest : " ${{steps.is_latest.outputs.IS_LATEST}}"
264
321
files : |
265
322
${{ env.DMG_FILE }}
266
323
${{ env.DEB_FILE }}
267
324
${{ env.EXE_FILE }}
268
325
${{ env.WEB_FILE }}
269
326
270
327
- name : Get repo name
328
+ if : startsWith(github.ref, 'refs/tags/') && !contains( github.ref, '-rc')
271
329
id : repo-name
272
330
run : |
273
331
echo "REPO_NAME=$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f 2)" >>$GITHUB_OUTPUT
274
332
275
333
- name : Get tag name
334
+ if : startsWith(github.ref, 'refs/tags/') && !contains( github.ref, '-rc')
276
335
id : tag-name
277
336
run : |
278
- echo "TAGNAME=$(echo $GITHUB_REF | cut -d / -f 3)" >>$GITHUB_OUTPUT
279
-
280
- - name : Gets JWT Token from GitHub
281
- uses : Chia-Network/actions/github/jwt@main
282
337
283
338
- name : Trigger apt repo update
339
+ if : startsWith(github.ref, 'refs/tags/') && !contains( github.ref, '-rc')
284
340
uses : Chia-Network/actions/github/glue@main
285
341
with :
286
342
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