9
9
- ' **'
10
10
11
11
concurrency :
12
- # SHA is added to the end if on `main` to let all main workflows run
13
- group : ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
12
+ group : ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}
14
13
cancel-in-progress : true
15
14
15
+
16
16
permissions :
17
17
id-token : write
18
18
contents : write
22
22
name : Build Mac Installer
23
23
runs-on : macos-latest
24
24
steps :
25
- - uses : Chia-Network/actions/clean-workspace@main
26
-
27
25
- name : Checkout Code
28
26
uses : actions/checkout@v4
29
27
38
36
- name : install dmg-license
39
37
run : npm i dmg-license
40
38
39
+ - name : Change the package.json version if an RC tag
40
+ shell : bash
41
+ if : startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
42
+ run : |
43
+ echo "Github ref: $GITHUB_REF"
44
+ IFS='/' read -r base directory tag <<< "$GITHUB_REF"
45
+ echo "Extracted tag is $tag"
46
+
47
+ jq ".version = \"${tag}\"" package.json > package.tmp
48
+ mv package.tmp package.json
49
+
41
50
- name : npm install
42
51
run : |
43
52
npm install
@@ -51,10 +60,10 @@ jobs:
51
60
if [ -n "$SIGNING_SECRET" ]; then HAS_SIGNING_SECRET='true' ; fi
52
61
echo "HAS_SIGNING_SECRET=${HAS_SIGNING_SECRET}" >> "$GITHUB_OUTPUT"
53
62
env :
54
- SIGNING_SECRET : " ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}"
55
-
63
+ SIGNING_SECRET : " ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}"
64
+
56
65
- name : Import Apple installer signing certificate
57
- if : steps.check_secrets.outputs.HAS_SIGNING_SECRET
66
+ if : steps.check_secrets.outputs.HAS_SIGNING_SECRET && startsWith(github.ref, 'refs/tags/') && startsWith(github.ref, 'refs/tags/')
58
67
uses : Apple-Actions/import-codesign-certs@v3
59
68
with :
60
69
p12-file-base64 : ${{ secrets.APPLE_DEV_ID_APP }}
66
75
run : npm run electron:package:mac
67
76
68
77
- name : Notarize
69
- if : steps.check_secrets.outputs.HAS_SIGNING_SECRET
78
+ if : steps.check_secrets.outputs.HAS_SIGNING_SECRET && startsWith(github.ref, 'refs/tags/')
70
79
run : |
71
80
DMG_FILE=$(find ${{ github.workspace }}/dist/ -type f -name '*.dmg')
72
81
xcrun notarytool submit \
@@ -100,6 +109,17 @@ jobs:
100
109
- name : Ignore Husky where not compatible
101
110
run : npm pkg delete scripts.prepare
102
111
112
+ - name : Change the package.json version if an RC tag
113
+ shell : bash
114
+ if : startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
115
+ run : |
116
+ echo "Github ref: $GITHUB_REF"
117
+ IFS='/' read -r base directory tag <<< "$GITHUB_REF"
118
+ echo "Extracted tag is $tag"
119
+
120
+ jq ".version = \"${tag}\"" package.json > package.tmp
121
+ mv package.tmp package.json
122
+
103
123
- name : npm install
104
124
run : |
105
125
node --version
@@ -117,8 +137,8 @@ jobs:
117
137
if [ -n "$SIGNING_SECRET" ]; then HAS_SIGNING_SECRET='true' ; fi
118
138
echo "HAS_SIGNING_SECRET=${HAS_SIGNING_SECRET}" >> "$GITHUB_OUTPUT"
119
139
env :
120
- SIGNING_SECRET : " ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}"
121
-
140
+ SIGNING_SECRET : " ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}"
141
+
122
142
# Windows Code Signing
123
143
- name : Get installer name for signing
124
144
shell : bash
@@ -158,6 +178,17 @@ jobs:
158
178
- name : Install Husky
159
179
run : npm install --save-dev husky
160
180
181
+ - name : Change the package.json version if an RC tag
182
+ shell : bash
183
+ if : startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
184
+ run : |
185
+ echo "Github ref: $GITHUB_REF"
186
+ IFS='/' read -r base directory tag <<< "$GITHUB_REF"
187
+ echo "Extracted tag is $tag"
188
+
189
+ jq ".version = \"${tag}\"" package.json > package.tmp
190
+ mv package.tmp package.json
191
+
161
192
- name : npm install
162
193
run : |
163
194
node --version
@@ -167,6 +198,7 @@ jobs:
167
198
run : npm run electron:package:linux
168
199
169
200
- name : Rename Linux installer to be standard format for apt
201
+ shell : bash
170
202
run : |
171
203
ORIGINAL=$(ls dist/*.deb)
172
204
MODIFIED=${ORIGINAL:0:-10}-1${ORIGINAL#${ORIGINAL:0:-10}}
@@ -193,6 +225,17 @@ jobs:
193
225
- name : Install Husky
194
226
run : npm install --save-dev husky
195
227
228
+ - name : Change the package.json version if an RC tag
229
+ shell : bash
230
+ if : startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
231
+ run : |
232
+ echo "Github ref: $GITHUB_REF"
233
+ IFS='/' read -r base directory tag <<< "$GITHUB_REF"
234
+ echo "Extracted tag is $tag"
235
+
236
+ jq ".version = \"${tag}\"" package.json > package.tmp
237
+ mv package.tmp package.json
238
+
196
239
- name : npm install and build
197
240
run : |
198
241
node --version
@@ -253,9 +296,33 @@ jobs:
253
296
echo "EXE_FILE=$EXE_FILE" >>$GITHUB_ENV
254
297
echo "WEB_FILE=$WEB_FILE" >>$GITHUB_ENV
255
298
299
+ # RC release should not be set as latest
300
+ - name : Decide if release should be set as latest
301
+ id : is_latest
302
+ shell : bash
303
+ run : |
304
+ unset IS_LATEST
305
+
306
+ echo "Github ref is $GITHUB_REF"
307
+
308
+ if [[ "$GITHUB_REF" =~ "-rc" ]]; then
309
+ echo "release candidate tag matched"
310
+ IS_LATEST='false'
311
+ IS_PRERELEASE='true'
312
+ else
313
+ echo "main branch release matched"
314
+ IS_LATEST='true'
315
+ IS_PRERELEASE='false'
316
+ fi
317
+
318
+ echo "IS_LATEST=${IS_LATEST}" >> "$GITHUB_OUTPUT"
319
+ echo "IS_PRERELEASE=${IS_PRERELEASE}" >> "$GITHUB_OUTPUT"
320
+
256
321
- name : Release
257
- uses : softprops/action-gh-release@v2.1.0
322
+ uses : softprops/action-gh-release@v2
258
323
with :
324
+ prerelease : ${{steps.is_latest.outputs.IS_PRERELEASE}}
325
+ make_latest : " ${{steps.is_latest.outputs.IS_LATEST}}"
259
326
files : |
260
327
${{ env.DMG_FILE }}
261
328
${{ env.DEB_FILE }}
@@ -268,6 +335,7 @@ jobs:
268
335
echo "TAGNAME=$(echo $GITHUB_REF | cut -d / -f 3)" >>$GITHUB_OUTPUT
269
336
270
337
- name : Trigger apt repo update
338
+ if : startsWith(github.ref, 'refs/tags/') && !contains( github.ref, '-rc')
271
339
uses : Chia-Network/actions/github/glue@main
272
340
with :
273
341
json_data : ' {"cadt_repo":"cadt-ui","release_version":"${{ steps.tag-name.outputs.TAGNAME }}"}'
0 commit comments