fix: keep windows runtime libs outside target

This commit is contained in:
coso
2026-05-27 16:59:53 +08:00
parent db86b28b0f
commit 35a554d84d
+7 -3
View File
@@ -288,12 +288,16 @@ jobs:
const path = require('path');
const target = process.env.TARGET_TRIPLE;
const runnerTemp = process.env.RUNNER_TEMP;
const srcTauri = path.resolve('src-tauri');
const portablePath = (value) => value.replace(/\\/g, '/');
const unique = (values) => [...new Set(values.filter(Boolean))];
if (target === 'x86_64-pc-windows-msvc') {
const runtimeDir = path.join(srcTauri, 'target', 'release-runtime-libs', target);
if (!runnerTemp) {
throw new Error('RUNNER_TEMP is required to stage Windows runtime libraries');
}
const runtimeDir = path.join(runnerTemp, 'lime-release-runtime-libs', target);
const dlls = ['onnxruntime.dll', 'sherpa-onnx-c-api.dll'];
const hookPath = path.join(srcTauri, 'target', 'release-runtime-libs.nsh');
fs.mkdirSync(path.dirname(hookPath), { recursive: true });
@@ -530,7 +534,7 @@ jobs:
set -euo pipefail
TARGET_TRIPLE="${{ matrix.target }}"
RELEASE_DIR="src-tauri/target/${TARGET_TRIPLE}/release"
RUNTIME_LIB_DIR="src-tauri/target/release-runtime-libs/${TARGET_TRIPLE}"
RUNTIME_LIB_DIR="${RUNNER_TEMP}/lime-release-runtime-libs/${TARGET_TRIPLE}"
PREBUILT_ROOT="src-tauri/target/sherpa-onnx-prebuilt"
SHERPA_ONNX_VERSION="$(node -e 'const fs = require("fs"); const lock = fs.readFileSync("src-tauri/Cargo.lock", "utf8"); const entry = lock.split(/\r?\n\[\[package\]\]\r?\n/).find((block) => /(?:^|\r?\n)name = "sherpa-onnx-sys"(?:\r?\n|$)/.test(block)); if (!entry) throw new Error("Unable to find sherpa-onnx-sys in src-tauri/Cargo.lock"); const match = entry.match(/(?:^|\r?\n)version = "([^"]+)"/); if (!match) throw new Error("Unable to resolve sherpa-onnx-sys version from src-tauri/Cargo.lock"); process.stdout.write(match[1]);')"
@@ -639,7 +643,7 @@ jobs:
run: |
set -euo pipefail
RELEASE_DIR="src-tauri/target/${{ matrix.target }}/release"
RUNTIME_LIB_DIR="src-tauri/target/release-runtime-libs/${{ matrix.target }}"
RUNTIME_LIB_DIR="${RUNNER_TEMP}/lime-release-runtime-libs/${{ matrix.target }}"
for dll in onnxruntime.dll sherpa-onnx-c-api.dll; do
if [ ! -f "$RUNTIME_LIB_DIR/$dll" ]; then
echo "::error::Expected staged ONNX runtime DLL missing: $RUNTIME_LIB_DIR/$dll"