-
Notifications
You must be signed in to change notification settings - Fork 2
409 lines (341 loc) Β· 13.3 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
name: Release
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- "main"
- "develop"
jobs:
vars:
name: "π§ Generate Variables"
runs-on: ubuntu-latest
outputs:
BRANCH_NAME: ${{ steps.step1.outputs.BRANCH_NAME }}
NPM_TAG: ${{ steps.step1.outputs.NPM_TAG }}
NEXT_MACH_VERSION: ${{ steps.step1.outputs.NEXT_MACH_VERSION }}
steps:
- uses: actions/checkout@v4
- id: step1
run: |
npm install -g pnpm && pnpm i
export BRANCH_NAME=${GITHUB_REF##*/}
export NPM_TAG=$BRANCH_NAME
if [ $NPM_TAG = "main" ]; then
export NPM_TAG="latest"
fi
NEXT_MACH_VERSION="$(node .github/scripts/ci/next-npm-version.mjs)"
echo "NEXT_MACH_VERSION=$NEXT_MACH_VERSION" >> $GITHUB_OUTPUT
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
echo "NPM_TAG=$NPM_TAG" >> $GITHUB_OUTPUT
echo NEXT_MACH_VERSION = $NEXT_MACH_VERSION
echo NPM_TAG = $NPM_TAG
echo BRANCH_NAME = $BRANCH_NAME
linux-amd64:
name: "π₯ Linux AMD64"
runs-on: ubuntu-latest
needs: [vars]
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: actions/setup-node@v4
with: { node-version: 20 }
- name: Build
env:
MACH_VERSION: ${{ needs.vars.outputs.NEXT_MACH_VERSION }}
run: |
set -ev
mkdir ${{ github.workspace }}/artifacts
sudo apt-get update
npm install -g npm pnpm
pnpm install
rustup target add x86_64-unknown-linux-gnu
profile=release os=linux arch=amd64 just build-publish
cd ${{ github.workspace }}/target/${{ github.job }}
mv release mach
tar -czvf mach-${{ github.job }}.tar.gz mach
mv mach-${{ github.job }}.tar.gz ${{ github.workspace }}/artifacts
cd ${{ github.workspace }}/npm/mach-os-arch
npm pack
mv *.tgz npm-mach-${{ github.job }}.tgz
mv *.tgz ${{ github.workspace }}/artifacts/npm-mach-${{ github.job }}.tgz
ls -l ${{ github.workspace }}/artifacts
- uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}.tar.gz
path: ${{ github.workspace }}/artifacts/**/*
if-no-files-found: error
retention-days: 1
linux-arm64:
name: "π₯ Linux ARM64"
runs-on: ubuntu-latest
needs: [vars]
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: actions/setup-node@v4
with: { node-version: 20 }
- name: Build
env:
MACH_VERSION: ${{ needs.vars.outputs.NEXT_MACH_VERSION }}
run: |
set -ev
mkdir ${{ github.workspace }}/artifacts
sudo apt-get update
npm install -g npm pnpm
pnpm install
sudo apt-get install gcc-aarch64-linux-gnu build-essential
rustup target add aarch64-unknown-linux-gnu
aarch64-linux-gnu-gcc --version
export CC=aarch64-linux-gnu-gcc
profile=release os=linux arch=arm64 just build-publish
cd ${{ github.workspace }}/target/${{ github.job }}
mv release mach
tar -czvf mach-${{ github.job }}.tar.gz mach
mv mach-${{ github.job }}.tar.gz ${{ github.workspace }}/artifacts
cd ${{ github.workspace }}/npm/mach-os-arch
npm pack
mv *.tgz npm-mach-${{ github.job }}.tgz
mv *.tgz ${{ github.workspace }}/artifacts/npm-mach-${{ github.job }}.tgz
ls -l ${{ github.workspace }}/artifacts
- uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}.tar.gz
path: ${{ github.workspace }}/artifacts/**/*
if-no-files-found: error
retention-days: 1
macos-amd64:
name: "π MacOS AMD64"
runs-on: macos-13
needs: [vars]
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: actions/setup-node@v4
with: { node-version: 20 }
- name: Build
env:
MACH_VERSION: ${{ needs.vars.outputs.NEXT_MACH_VERSION }}
run: |
set -ev
mkdir ${{ github.workspace }}/artifacts
npm install -g npm pnpm
pnpm install
rustup target add x86_64-apple-darwin
profile=release os=macos arch=amd64 just build-publish
cd ${{ github.workspace }}/target/${{ github.job }}
mv release mach
tar -czvf mach-${{ github.job }}.tar.gz mach
mv mach-${{ github.job }}.tar.gz ${{ github.workspace }}/artifacts
cd ${{ github.workspace }}/npm/mach-os-arch
npm pack
mv *.tgz npm-mach-${{ github.job }}.tgz
mv *.tgz ${{ github.workspace }}/artifacts/npm-mach-${{ github.job }}.tgz
ls -l ${{ github.workspace }}/artifacts
- uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}.tar.gz
path: ${{ github.workspace }}/artifacts/**/*
if-no-files-found: error
retention-days: 1
macos-arm64:
name: "π MacOS ARM64"
runs-on: macos-14
needs: [vars]
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: actions/setup-node@v4
with: { node-version: 20 }
- name: Build
env:
MACH_VERSION: ${{ needs.vars.outputs.NEXT_MACH_VERSION }}
run: |
set -ev
mkdir ${{ github.workspace }}/artifacts
npm install -g npm pnpm
pnpm install
rustup target add aarch64-apple-darwin
profile=release os=macos arch=arm64 just build-publish
cd ${{ github.workspace }}/target/${{ github.job }}
mv release mach
tar -czvf mach-${{ github.job }}.tar.gz mach
mv mach-${{ github.job }}.tar.gz ${{ github.workspace }}/artifacts
cd ${{ github.workspace }}/npm/mach-os-arch
npm pack
mv *.tgz npm-mach-${{ github.job }}.tgz
mv *.tgz ${{ github.workspace }}/artifacts/npm-mach-${{ github.job }}.tgz
ls -l ${{ github.workspace }}/artifacts
- uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}.tar.gz
path: ${{ github.workspace }}/artifacts/**/*
if-no-files-found: error
retention-days: 1
windows-amd64:
name: "π¦ Windows AMD64"
runs-on: windows-latest
needs: [vars]
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: actions/setup-node@v4
with: { node-version: 20 }
- name: Build
env:
MACH_VERSION: ${{ needs.vars.outputs.NEXT_MACH_VERSION }}
profile: release
os: windows
arch: amd64
run: |
mkdir ${{ github.workspace }}/artifacts
npm install -g npm pnpm
pnpm install
rustup target add x86_64-pc-windows-msvc
just build-publish
cd ${{ github.workspace }}/target/${{ github.job }}
mv release mach
tar -czvf mach-${{ github.job }}.tar.gz mach
mv mach-${{ github.job }}.tar.gz ${{ github.workspace }}/artifacts
cd ${{ github.workspace }}/npm/mach-os-arch
npm pack
mv *.tgz npm-mach-${{ github.job }}.tgz
mv *.tgz ${{ github.workspace }}/artifacts/npm-mach-${{ github.job }}.tgz
- uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}.tar.gz
path: ${{ github.workspace }}/artifacts/**/*
if-no-files-found: error
retention-days: 1
windows-arm64:
name: "π¦ Windows ARM64"
runs-on: windows-latest
needs: [vars]
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: actions/setup-node@v4
with: { node-version: 20 }
- name: Build
env:
MACH_VERSION: ${{ needs.vars.outputs.NEXT_MACH_VERSION }}
profile: release
os: windows
arch: arm64
run: |
mkdir ${{ github.workspace }}/artifacts
npm install -g npm pnpm
pnpm install
rustup target add aarch64-pc-windows-msvc
just build-publish
cd ${{ github.workspace }}/target/${{ github.job }}
mv release mach
tar -czvf mach-${{ github.job }}.tar.gz mach
mv mach-${{ github.job }}.tar.gz ${{ github.workspace }}/artifacts
cd ${{ github.workspace }}/npm/mach-os-arch
npm pack
mv *.tgz npm-mach-${{ github.job }}.tgz
mv *.tgz ${{ github.workspace }}/artifacts/npm-mach-${{ github.job }}.tgz
- uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}.tar.gz
path: ${{ github.workspace }}/artifacts/**/*
if-no-files-found: error
retention-days: 1
npm-package:
name: "π¦ NPM"
runs-on: ubuntu-latest
needs: [vars]
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: actions/setup-node@v4
with: { node-version: 20 }
- name: Build
env:
MACH_VERSION: ${{ needs.vars.outputs.NEXT_MACH_VERSION }}
run: |
set -ev
mkdir ${{ github.workspace }}/artifacts
sudo apt-get update
npm install -g npm pnpm
pnpm install
rustup target add x86_64-unknown-linux-gnu
profile=release os=linux arch=amd64 just build-publish
cd npm/mach
npm pack
mv *.tgz npm-mach.tgz
mv *.tgz ${{ github.workspace }}/artifacts/npm-mach.tgz
- uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}.tar.gz
path: ${{ github.workspace }}/artifacts/**/*
if-no-files-found: error
retention-days: 1
publish-github-release:
name: "π Github Release"
runs-on: ubuntu-latest
needs: [vars, npm-package, linux-amd64, linux-arm64, macos-amd64, macos-arm64, windows-amd64, windows-arm64]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/artifacts
- name: Publish` Github Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MACH_VERSION: ${{ needs.vars.outputs.NEXT_MACH_VERSION }}
BRANCH_NAME: ${{ needs.vars.outputs.BRANCH_NAME }}
run: |
set -ev
gh release create $MACH_VERSION --draft --notes "Automatically built binaries"
if [ "$BRANCH_NAME" == "main" ]; then
gh release edit $MACH_VERSION --title "π Mach - $MACH_VERSION"
else
gh release edit $MACH_VERSION --prerelease
gh release edit $MACH_VERSION --title "π§ͺ Branch: $BRANCH_NAME"
fi
gh release upload $MACH_VERSION "${{ github.workspace }}/artifacts/linux-amd64.tar.gz/mach-linux-amd64.tar.gz"
gh release upload $MACH_VERSION "${{ github.workspace }}/artifacts/linux-arm64.tar.gz/mach-linux-arm64.tar.gz"
gh release upload $MACH_VERSION "${{ github.workspace }}/artifacts/macos-amd64.tar.gz/mach-macos-amd64.tar.gz"
gh release upload $MACH_VERSION "${{ github.workspace }}/artifacts/macos-arm64.tar.gz/mach-macos-arm64.tar.gz"
gh release upload $MACH_VERSION "${{ github.workspace }}/artifacts/windows-amd64.tar.gz/mach-windows-amd64.tar.gz"
gh release upload $MACH_VERSION "${{ github.workspace }}/artifacts/windows-arm64.tar.gz/mach-windows-arm64.tar.gz"
gh release edit $MACH_VERSION --draft=false
publish-npm-package:
name: "π Publish: NPM"
runs-on: ubuntu-latest
needs: [vars, npm-package, linux-amd64, linux-arm64, macos-amd64, macos-arm64, windows-amd64, windows-arm64]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/artifacts
- name: Publish NPM Package
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
BRANCH_NAME: ${{ needs.vars.outputs.BRANCH_NAME }}
run: |
set -ev
npm install -g npm pnpm
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> $HOME/.npmrc
PACKAGES=(
"${{ github.workspace }}/artifacts/linux-amd64.tar.gz/npm-mach-linux-amd64.tgz"
"${{ github.workspace }}/artifacts/linux-arm64.tar.gz/npm-mach-linux-arm64.tgz"
"${{ github.workspace }}/artifacts/macos-amd64.tar.gz/npm-mach-macos-amd64.tgz"
"${{ github.workspace }}/artifacts/macos-arm64.tar.gz/npm-mach-macos-arm64.tgz"
"${{ github.workspace }}/artifacts/windows-amd64.tar.gz/npm-mach-windows-amd64.tgz"
"${{ github.workspace }}/artifacts/windows-arm64.tar.gz/npm-mach-windows-arm64.tgz"
"${{ github.workspace }}/artifacts/npm-package.tar.gz/npm-mach.tgz"
)
for PACKAGE in ${PACKAGES[@]}; do
if [ "$BRANCH_NAME" == "main" ]; then
echo Publishing latest tag
npm publish --access=public $PACKAGE
else
echo Publishing $BRANCH_NAME tag
npm publish --access=public --tag="$BRANCH_NAME" $PACKAGE
fi
done