44 lines
1.5 KiB
Bash
44 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
# tauri.conf.json — updater artifacts / pubkey (키 있을 때만 활성화)
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
CONF="$ROOT/desktop/src-tauri/tauri.conf.json"
|
|
KEY_PATH="${TAURI_SIGNER_KEY:-$HOME/.tauri/goldenchart.key}"
|
|
PUB_PATH="${TAURI_SIGNER_PUB:-$ROOT/desktop/updater.pub}"
|
|
|
|
enable="false"
|
|
if [[ -f "$KEY_PATH" && -f "$PUB_PATH" ]]; then
|
|
enable="true"
|
|
if [[ -x "$ROOT/scripts/patch-tauri-updater-pubkey.sh" ]]; then
|
|
"$ROOT/scripts/patch-tauri-updater-pubkey.sh"
|
|
fi
|
|
fi
|
|
|
|
node -e "
|
|
const fs = require('fs');
|
|
const confPath = process.argv[1];
|
|
const enable = process.argv[2] === 'true';
|
|
const conf = JSON.parse(fs.readFileSync(confPath, 'utf8'));
|
|
conf.bundle = conf.bundle || {};
|
|
conf.bundle.createUpdaterArtifacts = enable;
|
|
conf.plugins = conf.plugins || {};
|
|
conf.plugins.updater = conf.plugins.updater || {};
|
|
if (!conf.plugins.updater.endpoints?.length) {
|
|
conf.plugins.updater.endpoints = ['http://exdev.co.kr/desktop/updates/latest.json'];
|
|
}
|
|
if (!conf.plugins.updater.pubkey) {
|
|
conf.plugins.updater.pubkey = 'REPLACE_WITH_TAURI_SIGNER_PUBKEY';
|
|
}
|
|
fs.writeFileSync(confPath, JSON.stringify(conf, null, 2) + '\n');
|
|
console.log('[prepare-tauri-build] createUpdaterArtifacts=' + enable);
|
|
" "$CONF" "$enable"
|
|
|
|
if [[ "$enable" == "true" ]]; then
|
|
export TAURI_SIGNING_PRIVATE_KEY="$(tr -d '\n\r' < "$KEY_PATH")"
|
|
echo "[prepare-tauri-build] updater signing enabled"
|
|
else
|
|
unset TAURI_SIGNING_PRIVATE_KEY 2>/dev/null || true
|
|
echo "[prepare-tauri-build] updater signing skipped (no key)"
|
|
fi
|