-
Notifications
You must be signed in to change notification settings - Fork 4
647 lines (549 loc) · 25.4 KB
/
build.yml
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
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
name: build
on:
push:
branches:
- master
release:
types:
- created
workflow_dispatch:
inputs:
version:
description: "バージョン情報(A.BB.C / A.BB.C-preview.D)"
required: true
prerelease:
description: "プレリリースかどうか"
type: boolean
default: true
code_signing:
description: "コード署名する"
type: boolean
default: false
upload_artifact:
description: "デバッグ用に成果物をartifactにアップロードするか"
type: boolean
default: false
env:
PYTHON_VERSION: "3.11.3"
VOICEVOX_RESOURCE_VERSION: "0.16.0"
VOICEVOX_CORE_VERSION: "0.15.0"
defaults:
run:
shell: bash
jobs:
config: # 全 jobs で利用する定数の定義. `env` が利用できないコンテキストでも利用できる.
runs-on: ubuntu-latest
outputs:
version: ${{ steps.vars.outputs.version }}
version_or_latest: ${{ steps.vars.outputs.version_or_latest }}
steps:
- name: declare variables
id: vars
run: |
: # release タグ名, または workflow_dispatch でのバージョン名. リリースでない (push event) 場合は空文字列
echo "version=${{ github.event.release.tag_name || github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
: # release タグ名, または workflow_dispatch でのバージョン名, または 'latest'
echo "version_or_latest=${{ github.event.release.tag_name || github.event.inputs.version || 'latest' }}" >> "$GITHUB_OUTPUT"
build-and-upload:
needs: [config]
environment: ${{ github.event.inputs.code_signing == 'true' && 'code_signing' || '' }} # コード署名用のenvironment
strategy:
matrix:
include:
# Windows CPU
- os: windows-2019
architecture: "x64"
voicevox_core_asset_prefix: voicevox_core-windows-x64-cpu
onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-win-x64-1.13.1.zip
target: windows-cpu
# Windows DirectML
- os: windows-2019
architecture: "x64"
voicevox_core_asset_prefix: voicevox_core-windows-x64-directml
onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/Microsoft.ML.OnnxRuntime.DirectML.1.13.1.zip
directml_url: https://www.nuget.org/api/v2/package/Microsoft.AI.DirectML/1.10.0
target: windows-directml
# Windows NVIDIA GPU
- os: windows-2019
architecture: "x64"
voicevox_core_asset_prefix: voicevox_core-windows-x64-cuda
onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-win-x64-gpu-1.13.1.zip
cuda_version: "11.8.0"
cudnn_url: https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/windows-x86_64/cudnn-windows-x86_64-8.9.2.26_cuda11-archive.zip
zlib_url: http://www.winimage.com/zLibDll/zlib123dllx64.zip
target: windows-nvidia
# Mac CPU (x64 arch only)
- os: macos-11
architecture: "x64"
voicevox_core_asset_prefix: voicevox_core-osx-x64-cpu
onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-osx-x86_64-1.13.1.tgz
target: macos-x64
# Linux CPU
- os: ubuntu-20.04
architecture: "x64"
voicevox_core_asset_prefix: voicevox_core-linux-x64-cpu
onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-linux-x64-1.13.1.tgz
target: linux-cpu
# Linux NVIDIA GPU
- os: ubuntu-20.04
architecture: "x64"
voicevox_core_asset_prefix: voicevox_core-linux-x64-gpu
onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-linux-x64-gpu-1.13.1.tgz
cuda_version: "11.8.0"
cudnn_url: https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.9.2.26_cuda11-archive.tar.xz
target: linux-nvidia
runs-on: ${{ matrix.os }}
env:
# GNUコマンド
sed: ${{ startsWith(matrix.os, 'macos-') && 'gsed' || 'sed' }}
split: ${{ startsWith(matrix.os, 'macos-') && 'gsplit' || 'split' }}
steps:
- name: declare variables
id: vars
run: |
echo "package_name=aivisspeech-engine-${{ matrix.target }}-${{ needs.config.outputs.version }}" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
# NOTE: The default 'sed' and 'split' of macOS is BSD 'sed' and 'split'.
# There is a difference in specification between BSD 'sed' and 'split' and GNU 'sed' and 'split',
# so you need to install GNU 'sed' and 'split'.
- name: Install GNU sed on macOS
if: startsWith(matrix.os, 'macos-')
run: |
brew install gnu-sed coreutils
# ONNX Runtime providersとCUDA周りをリンクするために使う
- name: Install patchelf
if: startsWith(matrix.os, 'ubuntu-') && endsWith(matrix.target, 'nvidia')
run: |
sudo apt-get update
sudo apt-get install -y patchelf
# Download CUDA
- name: Restore cached CUDA
if: matrix.cuda_version != ''
uses: actions/cache/restore@v3
id: cuda-dll-cache-restore
with:
# update this key when ONNX Runtime CUDA dependency changed
key: ${{ matrix.os }}-cuda-dll-${{ matrix.cuda_version }}-v1
path: download/cuda
- name: Setup CUDA
if: matrix.cuda_version != '' && steps.cuda-dll-cache-restore.outputs.cache-hit != 'true'
uses: Jimver/[email protected]
id: cuda-toolkit
with:
method: network
cuda: ${{ matrix.cuda_version }}
- name: Extract CUDA Dynamic Libraries
if: matrix.cuda_version != '' && steps.cuda-dll-cache-restore.outputs.cache-hit != 'true'
run: |
set -eux
CUDA_ROOT=$( echo "${{ steps.cuda-toolkit.outputs.CUDA_PATH }}" | tr '\\' '/' )
mkdir -p download/cuda/bin
if [[ ${{ matrix.os }} == windows-* ]]; then
mv "${CUDA_ROOT}/bin/"*.dll download/cuda/bin/
# remove CUDA to reduce disk usage
rm -rf "${CUDA_ROOT}"
else
cp "${CUDA_ROOT}/lib64/"libcublas.so.* download/cuda/bin/
cp "${CUDA_ROOT}/lib64/"libcublasLt.so.* download/cuda/bin/
cp "${CUDA_ROOT}/lib64/"libcudart.so.* download/cuda/bin/
cp "${CUDA_ROOT}/lib64/"libcufft.so.* download/cuda/bin/
cp "${CUDA_ROOT}/lib64/"libcurand.so.* download/cuda/bin/
# remove unneed full version libraries
rm -f download/cuda/bin/libcublas.so.*.*
rm -f download/cuda/bin/libcublasLt.so.*.*
rm -f download/cuda/bin/libcufft.so.*.*
rm -f download/cuda/bin/libcurand.so.*.*
rm -f download/cuda/bin/libcudart.so.*.*.*
# remove CUDA to reduce disk usage
sudo rm -rf "${CUDA_ROOT}"
fi
- name: Save CUDA cache
if: matrix.cuda_version != ''
uses: actions/cache/save@v3
with:
key: ${{ steps.cuda-dll-cache-restore.outputs.cache-primary-key }}
path: download/cuda
# Download cuDNN
- name: Export cuDNN url to calc hash
if: matrix.cudnn_url != ''
run: echo "${{ matrix.cudnn_url }}" > download/cudnn_url.txt
- name: Restore cached cuDNN
if: matrix.cudnn_url != ''
uses: actions/cache/restore@v3
id: cudnn-dll-cache-restore
with:
# update this key when ONNX Runtime cuDNN dependency changed
key: ${{ matrix.os }}-cudnn-dll-${{ hashFiles('download/cudnn_url.txt') }}-v1
path: download/cudnn
- name: Download and extract cuDNN Dynamic Libraries
if: matrix.cudnn_url != '' && steps.cudnn-dll-cache-restore.outputs.cache-hit != 'true'
run: |
set -eux
if [[ ${{ matrix.os }} == windows-* ]]; then
curl -L "${{ matrix.cudnn_url }}" > download/cudnn.zip
unzip download/cudnn.zip cudnn-*/bin/*.dll -d download/cudnn_tmp
mkdir -p download/cudnn/bin
mv download/cudnn_tmp/cudnn-*/bin/*.dll download/cudnn/bin/
rm -rf download/cudnn_tmp
rm download/cudnn.zip
else
curl -L "${{ matrix.cudnn_url }}" > download/cudnn.tar.xz
tar -Jxf download/cudnn.tar.xz -C download/
mkdir -p download/cudnn/bin
cp download/cudnn-*/lib/libcudnn.so.* download/cudnn/bin/
cp download/cudnn-*/lib/libcudnn_*_infer.so.* download/cudnn/bin/
# remove unneed full version libraries
rm -f download/cudnn/bin/libcudnn.so.*.*
rm -f download/cudnn/bin/libcudnn_*_infer.so.*.*
rm download/cudnn.tar.xz
fi
- name: Save cuDNN cache
if: matrix.cudnn_url != ''
uses: actions/cache/save@v3
with:
key: ${{ steps.cudnn-dll-cache-restore.outputs.cache-primary-key }}
path: download/cudnn
# Donwload zlib
- name: Export zlib url to calc hash
if: matrix.zlib_url != ''
run: echo "${{ matrix.zlib_url }}" >> download/zlib_url.txt
- name: Restore cached zlib
if: matrix.zlib_url != ''
uses: actions/cache/restore@v3
id: zlib-cache-restore
with:
key: zlib-cache-v1-${{ hashFiles('download/zlib_url.txt') }}
path: download/zlib
- name: Download zlib
if: steps.zlib-cache-restore.outputs.cache-hit != 'true' && matrix.zlib_url != ''
run: |
curl -L "${{ matrix.zlib_url }}" -o download/zlib.zip
mkdir -p download/zlib
# extract only dlls
unzip download/zlib.zip dll_${{ matrix.architecture }}/zlibwapi.dll -d download/zlib
rm download/zlib.zip
mv download/zlib/dll_${{ matrix.architecture }}/zlibwapi.dll download/zlib/zlibwapi.dll
rm -r download/zlib/dll_${{ matrix.architecture }}
- name: Save zlib cache
if: matrix.zlib_url != ''
uses: actions/cache/save@v3
with:
key: ${{ steps.zlib-cache-restore.outputs.cache-primary-key }}
path: download/zlib
- name: Setup MSVC
if: startsWith(matrix.os, 'windows-')
uses: ilammy/msvc-dev-cmd@v1
# Python install path of windows: C:/hostedtoolcache/windows/Python
- name: Setup Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: ${{ matrix.architecture }}
cache: pip
- name: Install Python dependencies
run: |
python -m pip install -r requirements-dev.txt
if [ "$RUNNER_OS" = Windows ]; then
# Modify PyInstaller to enable NvOptimusEnablement and AmdPowerXpressRequestHighPerformance
./build_util/modify_pyinstaller.bash
fi
# Download pyopenjtalk dictionary
# try 5 times, sleep 5 seconds before retry
for i in $(seq 5); do
EXIT_CODE=0
python3 -c "import pyopenjtalk; pyopenjtalk._lazy_init()" || EXIT_CODE=$?
if [ "$EXIT_CODE" = "0" ]; then
break
fi
sleep 5
done
if [ "$EXIT_CODE" != "0" ]; then
exit "$EXIT_CODE"
fi
- name: Create download directory
run: mkdir -p download/
# Donwload DirectML
- name: Export DirectML url to calc hash
if: endswith(matrix.target, '-directml')
run: echo "${{ matrix.directml_url }}" >> download/directml_url.txt
- name: Restore cached DirectML
if: endswith(matrix.target, '-directml')
uses: actions/cache/restore@v3
id: directml-cache-restore
with:
key: directml-cache-v1-${{ hashFiles('download/directml_url.txt') }}
path: download/directml
- name: Download DirectML
if: steps.directml-cache-restore.outputs.cache-hit != 'true' && endswith(matrix.target, '-directml')
run: |
curl -L "${{ matrix.directml_url }}" -o download/directml.zip
mkdir -p download/directml
# extract only dlls
unzip download/directml.zip bin/${{ matrix.architecture }}-win/DirectML.dll -d download/directml
rm download/directml.zip
mv download/directml/bin/${{ matrix.architecture }}-win/DirectML.dll download/directml/DirectML.dll
rm -r download/directml/bin
- name: Save DirectML cache
if: endswith(matrix.target, '-directml')
uses: actions/cache/save@v3
with:
key: ${{ steps.directml-cache-restore.outputs.cache-primary-key }}
path: download/directml
# Download ONNX Runtime
- name: Export ONNX Runtime url to calc hash
run: echo "${{ matrix.onnxruntime_url }}" > download/onnxruntime_url.txt
- name: Restore cached ONNX Runtime
uses: actions/cache/restore@v3
id: onnxruntime-cache-restore
with:
key: ${{ matrix.os }}-onnxruntime-${{ hashFiles('download/onnxruntime_url.txt') }}-v1
path: download/onnxruntime
- name: Download ONNX Runtime (Windows)
if: steps.onnxruntime-cache-restore.outputs.cache-hit != 'true' && startsWith(matrix.os, 'windows-')
run: |
curl -L "${{ matrix.onnxruntime_url }}" > download/onnxruntime.zip
# extract only dlls
if [[ ${{ matrix.target }} != *-directml ]]; then
unzip download/onnxruntime.zip onnxruntime-*/lib/*.dll -d download/
mv download/onnxruntime-* download/onnxruntime
else
mkdir -p download/onnxruntime/lib
unzip download/onnxruntime.zip runtimes/win-${{ matrix.architecture }}/native/*.dll -d download/onnxruntime
mv download/onnxruntime/runtimes/win-${{ matrix.architecture }}/native/*.dll download/onnxruntime/lib/
rm -r download/onnxruntime/runtimes
fi
rm download/onnxruntime.zip
- name: Download ONNX Runtime (Mac/Linux)
if: steps.onnxruntime-cache-restore.outputs.cache-hit != 'true' && startsWith(matrix.os, 'windows-') != true
run: |
curl -L "${{ matrix.onnxruntime_url }}" > download/onnxruntime.tgz
mkdir -p download/onnxruntime
tar xf "download/onnxruntime.tgz" -C "download/onnxruntime" --strip-components 1
rm download/onnxruntime.tgz
- name: Save ONNX Runtime cache
uses: actions/cache/save@v3
with:
key: ${{ steps.onnxruntime-cache-restore.outputs.cache-primary-key }}
path: download/onnxruntime
# Download VOICEVOX RESOURCE
- name: Prepare VOICEVOX RESOURCE cache
uses: actions/cache@v3
id: voicevox-resource-cache
with:
key: voicevox-resource-${{ env.VOICEVOX_RESOURCE_VERSION }}
path: download/resource
- name: Checkout VOICEVOX RESOURCE
if: steps.voicevox-resource-cache.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: VOICEVOX/voicevox_resource
ref: ${{ env.VOICEVOX_RESOURCE_VERSION }}
path: download/resource
# Merge VOICEVOX RESOURCE
- name: Merge VOICEVOX RESOURCE
env:
DOWNLOAD_RESOURCE_PATH: download/resource
run: bash build_util/process_voicevox_resource.bash
# Download VOICEVOX Core
- name: Prepare VOICEVOX Core cache
uses: actions/cache@v3
id: voicevox-core-cache
with:
key: ${{ matrix.os }}-voicevox-core-${{ matrix.voicevox_core_asset_prefix }}-${{ env.VOICEVOX_CORE_VERSION }}
path: download/core
- name: Download VOICEVOX Core
if: steps.voicevox-core-cache.outputs.cache-hit != 'true'
env:
VOICEVOX_CORE_ASSET_NAME: ${{ matrix.voicevox_core_asset_prefix }}-${{ env.VOICEVOX_CORE_VERSION }}
run: |
curl -L "https://github.com/VOICEVOX/voicevox_core/releases/download/${{ env.VOICEVOX_CORE_VERSION }}/${{ env.VOICEVOX_CORE_ASSET_NAME }}.zip" > download/${{ env.VOICEVOX_CORE_ASSET_NAME }}.zip
if [[ ${{ matrix.os }} == mac-* ]]; then
ditto -x -k --sequesterRsrc --rsrc download/${{ env.VOICEVOX_CORE_ASSET_NAME }}.zip download/
else
unzip download/${{ env.VOICEVOX_CORE_ASSET_NAME }}.zip -d download/
fi
mkdir -p download/core
mv download/${{ env.VOICEVOX_CORE_ASSET_NAME }}/* download/core
rm -rf download/${{ env.VOICEVOX_CORE_ASSET_NAME }}
rm download/${{ env.VOICEVOX_CORE_ASSET_NAME }}.zip
- name: Generate licenses.json
run: |
OUTPUT_LICENSE_JSON_PATH=engine_manifest_assets/dependency_licenses.json \
bash build_util/create_venv_and_generate_licenses.bash
# FIXME: AivisSpeech (editor) cannot build without licenses.json
cp engine_manifest_assets/dependency_licenses.json licenses.json
- name: Build run.py with PyInstaller
run: |
set -eux
jq '.version = "${{ needs.config.outputs.version_or_latest }}"' engine_manifest.json > engine_manifest.json.tmp
mv -f engine_manifest.json.tmp engine_manifest.json
# Replace version & specify dynamic libraries
$sed -i "s/__version__ = \"latest\"/__version__ = \"${{ needs.config.outputs.version_or_latest }}\"/" voicevox_engine/__init__.py
if [[ ${{ matrix.os }} == windows-* ]]; then
LIBCORE_PATH=download/core/voicevox_core.dll
LIBONNXRUNTIME_PATH=download/onnxruntime/lib/onnxruntime.dll
elif [[ ${{ matrix.os }} == macos-* ]]; then
LIBCORE_PATH=download/core/libvoicevox_core.dylib
LIBONNXRUNTIME_PATH=download/onnxruntime/lib/libonnxruntime.dylib
else
LIBCORE_PATH=download/core/libvoicevox_core.so
LIBONNXRUNTIME_PATH=download/onnxruntime/lib/libonnxruntime.so
fi
CORE_MODEL_DIR_PATH="download/core/model" \
LIBCORE_PATH="$LIBCORE_PATH" \
LIBONNXRUNTIME_PATH="$LIBONNXRUNTIME_PATH" \
pyinstaller --noconfirm run.spec
- name: Gather DLL dependencies to dist/run/ (Windows)
if: startsWith(matrix.os, 'windows-')
run: |
set -eux
# Move DLL dependencies (cache already saved)
if [ -f "download/onnxruntime/lib/onnxruntime_providers_cuda.dll" ]; then
# ONNX Runtime providers (PyInstaller does not copy dynamic loaded libraries)
mv download/onnxruntime/lib/onnxruntime_*.dll dist/run/
# CUDA
mv download/cuda/bin/cublas64_*.dll dist/run/
mv download/cuda/bin/cublasLt64_*.dll dist/run/
mv download/cuda/bin/cudart64_*.dll dist/run/
mv download/cuda/bin/cufft64_*.dll dist/run/
mv download/cuda/bin/curand64_*.dll dist/run/
# cuDNN
mv download/cudnn/bin/cudnn64_*.dll dist/run/
mv download/cudnn/bin/cudnn_*_infer64*.dll dist/run/
# zlib
mv download/zlib/zlibwapi.dll dist/run/
# Remove source directories to reduce disk usage (already cached)
rm -rf download/onnxruntime
rm -rf download/cuda
rm -rf download/cudnn
rm -rf download/zlib
fi
if [[ ${{ matrix.target }} == *-directml ]]; then
# DirectML
mv download/directml/DirectML.dll dist/run/
# Remove source directory (already cached)
rm -rf download/directml
fi
- name: Gather DLL dependencies to dist/run/ (Linux CUDA)
if: startsWith(matrix.os, 'ubuntu-') && endsWith(matrix.target, 'nvidia')
run: |
set -eux
# Move DLL dependencies (cache already saved)
# ONNX Runtime providers (PyInstaller does not copy dynamic loaded libraries)
patchelf --set-rpath '$ORIGIN' "$(pwd)/download/onnxruntime/lib"/libonnxruntime_providers_*.so
mv download/onnxruntime/lib/libonnxruntime_*.so dist/run/
# CUDA
mv download/cuda/bin/libcublas.so.* dist/run/
mv download/cuda/bin/libcublasLt.so.* dist/run/
mv download/cuda/bin/libcudart.so.* dist/run/
mv download/cuda/bin/libcufft.so.* dist/run/
mv download/cuda/bin/libcurand.so.* dist/run/
# cuDNN
mv download/cudnn/bin/libcudnn.so.* dist/run/
mv download/cudnn/bin/libcudnn_*_infer.so.* dist/run/
# Remove source directories to reduce disk usage (already cached)
rm -rf download/onnxruntime
rm -rf download/cuda
rm -rf download/cudnn
- name: Set @rpath to @executable_path
if: startsWith(matrix.os, 'macos-')
run: |
install_name_tool -add_rpath @executable_path/. dist/run/run
- name: Code signing
if: github.event.inputs.code_signing == 'true' && startsWith(matrix.os, 'windows-')
run: |
bash build_util/codesign.bash "dist/run/run.exe"
env:
ESIGNERCKA_USERNAME: ${{ secrets.ESIGNERCKA_USERNAME }}
ESIGNERCKA_PASSWORD: ${{ secrets.ESIGNERCKA_PASSWORD }}
ESIGNERCKA_TOTP_SECRET: ${{ secrets.ESIGNERCKA_TOTP_SECRET }}
- name: Rename artifact directory to archive
run: |
mv dist/run/ "${{ matrix.target }}/"
# 7z archives
- name: Create 7z archives
run: |
# Compress to artifact.7z.001, artifact.7z.002, ...
7z -r -v1900m a "${{ steps.vars.outputs.package_name }}.7z" "${{ matrix.target }}/"
# Output splitted archive list
ls ${{ steps.vars.outputs.package_name }}.7z.* > archives_7z.txt
mv archives_7z.txt "${{ steps.vars.outputs.package_name }}.7z.txt"
- name: Upload 7z archives to artifact
if: github.event.inputs.upload_artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.vars.outputs.package_name }}
path: |
${{ steps.vars.outputs.package_name }}.7z.*
- name: Upload 7z archives to Release assets
if: needs.config.outputs.version != ''
uses: ncipollo/release-action@v1
with:
allowUpdates: true
prerelease: ${{ github.event.inputs.prerelease }}
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.config.outputs.version }}
artifacts: >
${{ steps.vars.outputs.package_name }}.7z.*
commit: ${{ github.sha }}
- name: Clean 7z archives to reduce disk usage
run: |
rm -f ${{ steps.vars.outputs.package_name }}.7z.*
# VVPP archives
- name: Create VVPP archives
run: |
# Compress to compressed.zip.001, compressed.zip.002, ...
# NOTE: 1000th archive will be "compressed.zip.1000" after "compressed.zip.999". This is unconsidered as an extreme case.
(cd "${{ matrix.target }}" && 7z -r -v1900M a "../compressed.zip")
# Rename to artifact.001.vvppp, artifact.002.vvppp, ...
for FILE in $(ls "compressed.zip."*); do
NUMBER=${FILE##*.} # 001
mv "${FILE}" "${{ steps.vars.outputs.package_name }}.${NUMBER}.vvppp"
done
# Rename to artifact.vvpp if there are only artifact.001.vvppp
if [ "$(ls ${{ steps.vars.outputs.package_name }}.*.vvppp | wc -l)" == 1 ]; then
mv ${{ steps.vars.outputs.package_name }}.001.vvppp ${{ steps.vars.outputs.package_name }}.vvpp
fi
# Output splitted archive list
ls ${{ steps.vars.outputs.package_name }}*.vvppp ${{ steps.vars.outputs.package_name }}.vvpp > archives_vvpp.txt || true
mv archives_vvpp.txt "${{ steps.vars.outputs.package_name }}.vvpp.txt"
- name: Upload VVPP archives to artifact
if: github.event.inputs.upload_artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.vars.outputs.package_name }}
path: |
${{ steps.vars.outputs.package_name }}.vvpp
${{ steps.vars.outputs.package_name }}*.vvppp
${{ steps.vars.outputs.package_name }}.vvpp.txt
- name: Upload VVPP archives to Release assets
if: needs.config.outputs.version != ''
uses: ncipollo/release-action@v1
with:
allowUpdates: true
prerelease: ${{ github.event.inputs.prerelease }}
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.config.outputs.version }}
artifacts: >
${{ steps.vars.outputs.package_name }}.vvpp,
${{ steps.vars.outputs.package_name }}*.vvppp,
${{ steps.vars.outputs.package_name }}.vvpp.txt
commit: ${{ github.sha }}
update-tag-to-current-commit:
if: needs.config.outputs.version != ''
needs: [config, build-and-upload]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Change tag to this commit for refreshing the release # c.f. voicevox_engine#854
run: |
git tag -f ${{ needs.config.outputs.version }}
git push -f --tag
run-release-test-workflow:
if: needs.config.outputs.version != ''
needs: [config, build-and-upload]
uses: ./.github/workflows/release-test.yml
with:
version: ${{ needs.config.outputs.version }}
repo_url: ${{ format('{0}/{1}', github.server_url, github.repository) }} # このリポジトリのURL