generated from SKalt/rust-nix-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
608 lines (587 loc) · 25.4 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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
name: build and release
on:
workflow_dispatch: # for manual debugging
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
build-bin:
strategy:
fail-fast: false # to see what builds/what fails
matrix:
include:
# each `target` is picked from `rustup target list` and each
# `vscode-target` is drawn from `vsce publish --help`
# x86 windows
- os: windows-latest
native:
target: x86_64-pc-windows-msvc
vscode-target: win32-x64
- os: ubuntu-latest
native:
target: x86_64-unknown-linux-gnu
vscode-target: linux-x64 # todo: fully-static MUSL?
zig: false
cross:
target: aarch64-unknown-linux-gnu
vscode-target: linux-arm64
zig: true
- os: macos-latest
native:
target: x86_64-apple-darwin
vscode-target: darwin-x64
zig: true
cross:
target: aarch64-apple-darwin
vscode-target: darwin-arm64
zig: true
name: Build (${{ matrix.native.target }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # shallow clone for speed
- name: "cache native base binary build: ${{ matrix.native.target }}"
uses: actions/cache@v4
id: native-base-cache
with:
path: |
./target/${{ matrix.native.target }}/release/base_language_server*
./target/${{ matrix.native.target }}/release/base_language_server.exe
./target/${{ matrix.native.target }}/release/base_language_server.pdb
# hardcode paths in an attempt to appease windows
key: ${{ matrix.native.target }}--${{ hashFiles('./Cargo.lock', 'pkg/base/Cargo.toml', 'pkg/base/**/*.rs', 'pkg/base/**/*.scm', './scripts/build_bin.sh') }}
- name: "cache cross base binary build: ${{ matrix.cross.target }}"
uses: actions/cache@v4
if: matrix.cross.target
id: cross-base-cache
with:
path: |
./target/${{ matrix.cross.target }}/release/base_language_server*
./target/${{ matrix.cross.target }}/release/base_language_server.exe
./target/${{ matrix.cross.target }}/release/base_language_server.pdb
key: ${{ matrix.cross.target }}--${{ hashFiles('./Cargo.lock', 'pkg/pro/Cargo.toml', 'pkg/base/**/*.rs', 'pkg/base/**/*.scm') }}
- name: "cache native pro binary build: ${{ matrix.native.target }}"
uses: actions/cache@v4
id: native-pro-cache
with:
path: |
./target/${{ matrix.native.target }}/release/pro_language_server*
./target/${{ matrix.native.target }}/release/pro_language_server.exe
./target/${{ matrix.native.target }}/release/pro_language_server.pdb
# hardcode paths in an attempt to appease windows
key: ${{ matrix.native.target }}--${{ hashFiles('./Cargo.lock', '**/Cargo.toml', 'pkg/base/**/*.rs', 'pkg/base/**/*.scm', './scripts/build_bin.sh') }}
- name: "cache cross pro binary build: ${{ matrix.cross.target }}"
uses: actions/cache@v4
if: matrix.cross.target
id: cross-pro-cache
with:
path: |
./target/${{ matrix.cross.target }}/release/pro_language_server*
./target/${{ matrix.cross.target }}/release/pro_language_server.exe
./target/${{ matrix.cross.target }}/release/pro_language_server.pdb
key: ${{ matrix.cross.target }}--${{ hashFiles('./Cargo.lock', '**/Cargo.toml', 'pkg/base/**/*.rs', 'pkg/base/**/*.scm') }}
- id: boot
shell: bash
run: |
ref_name="${{ github.ref_name }}"
native_base="${{ steps.native-base-cache.outputs.cache-hit != 'true'|| false }}"
native_pro="${{ steps.native-pro-cache.outputs.cache-hit != 'true' || false }}"
cross_base="${{ matrix.cross.target && steps.cross-base-cache.outputs.cache-hit != 'true' || false }}"
cross_pro="${{ matrix.cross.target && steps.native-pro-cache.outputs.cache-hit != 'true' || false }}"
{
case true in
$native_base|$native_pro|$cross_base|$cross_pro) echo "init=true" ;;
*) echo "init=false" ;;
esac
echo "native_base=$native_base"
echo "cross_base=$cross_base"
echo "native_pro=$native_pro"
echo "cross_pro=$cross_pro"
} | tee -a "$GITHUB_OUTPUT"
- name: set MacOS SDKROOT and MACOSX_DEPLOYMENT_TARGET
# see https://stackoverflow.com/questions/66849112/how-do-i-cross-compile-a-rust-application-from-macos-x86-to-macos-silicon
if: matrix.os == 'macos-latest' && steps.boot.outputs.init == 'true'
run: |
{
echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)"
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)"
} | tee -a $GITHUB_ENV
- name: "Install rust toolchain"
if: steps.boot.outputs.init == 'true'
shell: bash
run: |
rustup toolchain install stable --profile minimal
rustup component add rust-src
rustup component add llvm-tools-preview # 32mb
# pulling 3x32MB of llvm tools is still better than pushing+pulling
# 6x60MB of the built binary
- name: "install native rust target: ${{ matrix.native.target }}"
shell: bash
if: steps.boot.outputs.native_base == 'true' || steps.boot.outputs.native_pro == 'true'
run: rustup target add ${{ matrix.native.target }}
- uses: Swatinem/rust-cache@v2 # see https://github.com/Swatinem/rust-cache
if: steps.boot.outputs.init == 'true'
- name: setup zig
if: steps.boot.outputs.init == 'true'
shell: bash
run: python3 -m pip install ziglang cargo-zigbuild
- name: modify $PATH
shell: bash
if: steps.boot.outputs.init == 'true'
run: |
{
site_packages="$(
python3 -c 'import sys, pathlib as p; [
print(i) for i in sys.path
if p.Path(i).name == "site-packages"
]'
)"
_sysroot="$(rustup run stable rustc --print sysroot)"
bins_dir="$_sysroot/lib/rustlib/${{ matrix.native.target }}/bin"
export PATH="$bins_dir:$site_packages/ziglang:$PATH"
echo "PATH=$PATH"
} | tee -a $GITHUB_ENV | tr ':' '\n' | sed 's/^/ - /g'
- name: "build native base bin: ${{ matrix.native.target }}"
shell: bash
if: steps.native-base-cache.outputs.cache-hit != 'true'
run: |
target="${{ matrix.native.target }}"
use_zig="${{ matrix.native.zig || 'false' }}"
export RUSTFLAGS="-Clink-args=-Wl,--build-id=sha1"
./scripts/build_bin.sh \
--version=base \
--profile=release \
--target="$target" \
--zig="$use_zig"
- name: "upload native base bin: ${{ matrix.native.target }}"
uses: actions/upload-artifact@v4
with:
name: cconvention-base-${{matrix.native.target}}
path: ./target/${{matrix.native.target}}/release/base_language_server*
if-no-files-found: error
- name: "build native pro bin: ${{ matrix.native.target }}"
shell: bash
if: steps.native-pro-cache.outputs.cache-hit != 'true'
run: |
target="${{ matrix.native.target }}"
use_zig="${{ matrix.native.zig || 'false' }}"
export RUSTFLAGS="-Clink-args=-Wl,--build-id=sha1"
./scripts/build_bin.sh \
--version=pro \
--profile=release \
--target="$target" \
--zig="$use_zig"
- name: "upload native pro bin: ${{ matrix.native.target }}"
uses: actions/upload-artifact@v4
with:
name: cconvention-pro-${{matrix.native.target}}
path: ./target/${{matrix.native.target}}/release/pro_language_server*
if-no-files-found: error
- name: "add rustup cross-compilation target: ${{ matrix.cross.target || 'none' }}"
if: steps.boot.outputs.cross_base == 'true' || steps.boot.outputs.cross_pro == 'true'
shell: bash
run: rustup target add ${{ matrix.cross.target }}
- name: "build cross base bin: ${{ matrix.cross.target || 'none' }}"
if: matrix.cross.target && steps.cross-base-cache.outputs.cache-hit != 'true'
shell: bash
run: |
target="${{ matrix.cross.target }}"
use_zig="${{ matrix.cross.zig || 'false' }}"
export RUSTFLAGS="-Clink-args=-Wl,--build-id=sha1"
./scripts/build_bin.sh \
--version=base \
--profile=release \
--target="$target" \
--zig="$use_zig"
- name: "upload cross base bin: ${{ matrix.cross.target }}"
if: matrix.cross.target
uses: actions/upload-artifact@v4
with:
name: cconvention-base-${{matrix.cross.target}} # TODO: include version in name?
path: ./target/${{matrix.cross.target}}/release/base_language_server*
if-no-files-found: error
- name: "build cross pro bin: ${{ matrix.cross.target || 'none' }}"
if: matrix.cross.target && steps.cross-pro-cache.outputs.cache-hit != 'true'
shell: bash
run: |
target="${{ matrix.cross.target }}"
use_zig="${{ matrix.cross.zig || 'false' }}"
export RUSTFLAGS="-Clink-args=-Wl,--build-id=sha1"
./scripts/build_bin.sh \
--version=pro \
--profile=release \
--target="$target" \
--zig="$use_zig"
- name: "upload cross pro bin: ${{ matrix.cross.target }}"
if: matrix.cross.target
uses: actions/upload-artifact@v4
with:
name: cconvention-pro-${{matrix.cross.target}}
path: ./target/${{matrix.cross.target}}/release/pro_language_server*
if-no-files-found: error
- name: debug
shell: bash
run: |
git diff
build-js:
name: Bundle VSCode extension JS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # shallow clone for speed
- name: cache the built JS
uses: actions/cache@v4
id: built-base-js
with:
path: ./editors/code/base/dist/main.min.common.js
key: "built-js-for-${{ hashfiles('./editors/code/base/src/*.ts', './editors/code/base/pnpm-lock.yaml') }}"
- name: cache the built textmate grammar
uses: actions/cache@v4
id: textmate
with:
path: ./editors/code/base/dist/tmLanguage.json
key: "textmate-${{ hashfiles('./editors/code/base/src/tmLanguage.yaml') }}"
- uses: pnpm/action-setup@v2 # see https://github.com/pnpm/action-setup
if: steps.built-base-js.outputs.cache-hit != 'true' || steps.textmate.outputs.cache-hit != 'true'
with:
version: 8
- uses: actions/setup-node@v3 # see https://github.com/actions/setup-node/
if: steps.built-base-js.outputs.cache-hit != 'true' || steps.textmate.outputs.cache-hit != 'true'
with:
node-version: 20
cache: "pnpm"
cache-dependency-path: |
./editors/code/base/pnpm-lock.yaml
./editors/code/pro/pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
working-directory: editors/code/base
if: steps.built-base-js.outputs.cache-hit != 'true' || steps.textmate.outputs.cache-hit != 'true'
- name: modify $PATH
shell: bash
working-directory: ./editors/code/base
run: |
export PATH=${PWD}/node_modules/.bin:$PATH
echo PATH=$PATH | tee -a $GITHUB_ENV
- name: build the textmate grammar if changed
if: steps.textmate.outputs.cache-hit != 'true'
shell: bash
working-directory: ./editors/code/base
run: ./scripts/build_textmate.sh
- name: upload the textmate grammar
uses: actions/upload-artifact@v4
with:
name: tmLanguage
path: ./editors/code/base/dist/tmLanguage.json
if-no-files-found: error
- name: build the JS if changed
shell: bash
if: steps.built-base-js.outputs.cache-hit != 'true'
working-directory: ./editors/code/base
run: ./scripts/build_js.sh
- name: upload bundled JS
uses: actions/upload-artifact@v4
with:
name: main-js
path: ./editors/code/base/dist/main.min.common.js
if-no-files-found: error
build-vsix:
name: Build and publish vsix
needs: [build-bin, build-js]
runs-on: ubuntu-latest
strategy:
fail-fast: false # to see what builds/what fails
matrix:
include:
- os: windows-latest
native:
target: x86_64-pc-windows-msvc
vscode-target: win32-x64
- os: ubuntu-latest
native:
target: x86_64-unknown-linux-gnu
vscode-target: linux-x64 # todo: fully-static MUSL?
cross:
target: aarch64-unknown-linux-gnu
vscode-target: linux-arm64
- os: macos-latest
native:
target: x86_64-apple-darwin
vscode-target: darwin-x64
cross:
target: aarch64-apple-darwin
vscode-target: darwin-arm64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # shallow clone for speed
- name: "download native base binary: ${{ matrix.native.target }}"
uses: actions/download-artifact@v4
# https://github.com/actions/download-artifact
with:
name: cconvention-base-${{ matrix.native.target }}
path: ./target/${{ matrix.native.target }}/release/
- name: "download cross base binary: ${{ matrix.cross.target || '<skip>' }}"
uses: actions/download-artifact@v4
if: matrix.cross.target
with:
name: cconvention-base-${{ matrix.cross.target }}
path: ./target/${{ matrix.cross.target }}/release/
- name: "download native pro binary: ${{ matrix.native.target }}"
uses: actions/download-artifact@v4
# https://github.com/actions/download-artifact
with:
name: cconvention-pro-${{ matrix.native.target }}
path: ./target/${{ matrix.native.target }}/release/
- name: "download cross pro binary: ${{ matrix.cross.target || '<skip>' }}"
uses: actions/download-artifact@v4
if: matrix.cross.target
with:
name: cconvention-pro-${{ matrix.cross.target }}
path: ./target/${{ matrix.cross.target }}/release/
- name: "download bundled JS"
uses: actions/download-artifact@v4
with:
name: main-js
path: ./editors/code/base/dist/
- name: "download textmate grammar"
uses: actions/download-artifact@v4
with:
name: tmLanguage
path: ./editors/code/base/dist/
- name: "ensure dist directories exist"
shell: bash
run: |
set -eu
cd ./editors/code/
mkdir -p ./pro/dist
cp ./base/dist/main.min.common.js ./base/dist/tmLanguage.json ./pro/dist/
- name: derive paths
id: paths
run: |
case "${{ matrix.os }}" in
ubuntu-latest) bin_suffix="" ; debug_suffix=".debug" ;;
windows-latest) bin_suffix=".exe"; debug_suffix=".pdb" ;;
macos-latest) bin_suffix="" ; debug_suffix=".dSYM" ;;
esac
native_base_bin="${PWD}/target/${{ matrix.native.target }}/release/base_language_server$bin_suffix"
native_base_debug="${PWD}/target/${{ matrix.native.target }}/release/base_language_server$debug_suffix"
cross_base_bin="${PWD}/target/${{ matrix.cross.target }}/release/base_language_server$bin_suffix"
cross_base_debug="${PWD}/target/${{ matrix.cross.target }}/release/base_language_server$debug_suffix"
native_pro_bin="${PWD}/target/${{ matrix.native.target }}/release/pro_language_server$bin_suffix"
native_pro_debug="${PWD}/target/${{ matrix.native.target }}/release/pro_language_server$debug_suffix"
cross_pro_bin="${PWD}/target/${{ matrix.cross.target }}/release/pro_language_server$bin_suffix"
cross_pro_debug="${PWD}/target/${{ matrix.cross.target }}/release/pro_language_server$debug_suffix"
{
echo "native_base_bin=$native_base_bin"
echo "native_base_debug=$native_base_debug"
echo "cross_base_bin=$cross_base_bin"
echo "cross_base_debug=$cross_base_debug"
echo "native_pro_bin=$native_pro_bin"
echo "native_pro_debug=$native_pro_debug"
echo "cross_pro_bin=$cross_pro_bin"
echo "cross_pro_debug=$cross_pro_debug"
} | tee -a $GITHUB_OUTPUT
stat $native_base_bin || {
echo "$native_bin not found"
ls -al ./target/${{ matrix.native.target }}/release/
find ./target/${{ matrix.native.target }}/release/ -name 'base_language_server*'
}
stat $native_base_debug || echo "$native_debug not found"
stat $cross_base_bin || echo "$cross_bin not found"
stat $cross_base_debug || echo "$cross_debug not found"
- uses: pnpm/action-setup@v2 # see https://github.com/pnpm/action-setup
with:
version: 8
- uses: actions/setup-node@v3 # see https://github.com/actions/setup-node/
with:
node-version: 20
cache: "pnpm"
cache-dependency-path: |
./editors/code/base/pnpm-lock.yaml
./editors/code/pro/pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
working-directory: editors/code/base
- name: modify $PATH
shell: bash
working-directory: ./editors/code/base
run: |
export PATH=${PWD}/node_modules/.bin:$PATH
echo PATH=$PATH | tee -a $GITHUB_ENV
- name: build the base ${{ matrix.native.vscode-target }} vsix
shell: bash
run: |
./scripts/build_vsix.sh \
--version=base \
--profile=release \
--target=${{ matrix.native.target }}
- name: upload the base ${{ matrix.native.vscode-target }} vsix
uses: actions/upload-artifact@v4
with:
name: cconvention-base-${{matrix.native.vscode-target}}.vsix
path: ./editors/code/base/dist/cconvention.${{ matrix.native.vscode-target }}.vsix
if-no-files-found: error
- name: build the base ${{ matrix.cross.vscode-target || '<missing cross>' }} vsix
if: matrix.cross.target
shell: bash
run: |
./scripts/build_vsix.sh \
--version=base \
--profile=release \
--target=${{ matrix.cross.target }}
- name: upload the base ${{ matrix.cross.vscode-target || '<missing cross>' }} vsix
if: matrix.cross.target
uses: actions/upload-artifact@v4
with:
name: cconvention-base-${{matrix.cross.vscode-target}}.vsix
path: ./editors/code/base/dist/cconvention.${{ matrix.cross.vscode-target }}.vsix
if-no-files-found: error
- name: publish the base ${{ matrix.cross.vscode-target || '<missing cross>' }} vsix
if: matrix.cross.target && startsWith(github.ref_name, 'v')
shell: bash
run: |
set -eu
cd ./editors/code/base
VSCE_PAT=${{ secrets.BASE_VSCE_PAT }} vsce publish \
--no-dependencies \
--no-git-tag-version \
--skip-duplicate \
--packagePath \
./dist/cconvention.${{matrix.cross.vscode-target}}.vsix
- name: build the pro ${{ matrix.native.vscode-target }} vsix
shell: bash
run: |
./scripts/build_vsix.sh \
--version=pro \
--profile=release \
--target=${{ matrix.native.target }}
- name: upload the pro ${{ matrix.native.vscode-target }} vsix
uses: actions/upload-artifact@v4
with:
name: cconvention-pro-${{matrix.native.vscode-target}}.vsix
path: ./editors/code/pro/dist/cconvention.${{ matrix.native.vscode-target }}.vsix
if-no-files-found: error
- name: build the pro ${{ matrix.cross.vscode-target || '<missing cross>' }} vsix
if: matrix.cross.target
shell: bash
run: |
./scripts/build_vsix.sh \
--version=pro \
--profile=release \
--target=${{ matrix.cross.target }}
- name: upload the pro ${{ matrix.cross.vscode-target || '<missing cross>' }} vsix
if: matrix.cross.target
uses: actions/upload-artifact@v4
with:
name: cconvention-pro-${{matrix.cross.vscode-target}}.vsix
path: ./editors/code/pro/dist/cconvention.${{ matrix.cross.vscode-target }}.vsix
if-no-files-found: error
- name: "check cross base debuginfo: ${{ matrix.cross.target || '<skip>'}}"
if: matrix.cross.target
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then suffix=".exe";
else suffix=""
fi
bin="./target/${{ matrix.native.target }}/release/base_language_server$suffix"
sentry-cli debug-files check $bin
- name: "check native base debuginfo: ${{ matrix.native.target }}"
run: |
command -v sentry-cli || echo "missing sentry-cli"
bin=${{ steps.paths.outputs.native_base_bin }}
debug=${{ steps.paths.outputs.native_base_debug }}
echo bin=$bin
stat $bin || echo "$bin not found"
sentry-cli debug-files check $bin
if [ -e "$debug" ]; then
sentry-cli debug-files check $debug
else
echo "$debug not found"
fi
release:
name: Create GitHub release
runs-on: ubuntu-latest
needs: [build-vsix]
steps:
- name: Get the release version from the tag
id: "release_id"
if: env.VERSION == ''
shell: bash
run: |
semver_regex='^v[0-9]+\.[0-9]+\.[0-9]+$'
github_ref="${{ github.ref_name }}"
echo "ref=${github_ref}"
if (echo "$github_ref" | grep -qE "$semver_regex"); then
echo "VERSION=${github_ref/v/}" | tee -a "$GITHUB_ENV"
echo "ok=true" | tee -a "$GITHUB_OUTPUT"
else
echo "ok=false" | tee -a "$GITHUB_OUTPUT"
fi
- uses: actions/checkout@v4
if: steps.release_id.outputs.ok == 'true'
with:
fetch-depth: 1 # shallow clone for speed
- name: Check that tag version and Cargo.toml version are the same
shell: bash
if: steps.release_id.outputs.ok == 'true'
run: |
if ! grep -q "version = \"$VERSION\"" ./pkg/*/Cargo.toml; then
echo "version does not match Cargo.toml" >&2
exit 1
fi
- name: Create GitHub release
if: steps.release_id.outputs.ok == 'true'
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: gh release create "v$VERSION" --draft --verify-tag --title "v$VERSION"
- uses: actions/download-artifact@v4
if: steps.release_id.outputs.ok == 'true'
with:
pattern: "cconvention-*"
path: artifacts
- name: flatten directory
shell: bash
run: |
sudo apt install -y tree
tree ./artifacts
mkdir flattened
# since all arch-specific builds of the cli are named cconvention,
# rename them when moving them into the directory to upload
variants=(base pro)
triples=(
x86_64-unknown-linux-gnu
aarch64-unknown-linux-gnu
x86_64-apple-darwin
aarch64-apple-darwin
)
for variant in "${variants[@]}"; do
for triple in "${triples[@]}"; do
name="cconvention-${variant}-${triple}"
cp \
"./artifacts/${name}/${variant}_language_server" \
"./flattened/cconvention-${variant}-${triple}"
done
done
for variant in "${variants[@]}"; do
triple=x86_64-pc-windows-msvc
name="cconvention-${variant}-${triple}"
cp \
"./artifacts/${name}/${variant}_language_server.exe" \
"./flattened/cconvention-${variant}-${triple}.exe"
done
# all vsix variants have unique names
cp ./artifacts/**/*.vsix ./flattened/
- name: "checksums"
if: steps.release_id.outputs.ok == 'true'
shell: bash
run: |
cd flattened && shasum -a 256 * > checksums.txt
- name: "upload artifacts"
if: steps.release_id.outputs.ok == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
shell: bash
run: |
cd flattened &&
find . -type f -exec gh release upload "v$VERSION" '{}' ';'