38 lines
2.1 KiB
Bash
Executable File
38 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# Puts the Windows installer on the Kestrove website and offers it as an update: signs it with the updater key if
|
|
# needed, copies it to the website's downloads/, and writes the website's updates/latest.json, which the app checks
|
|
# (src-tauri/src/updates.rs).
|
|
#
|
|
# TAURI_SIGNING_PRIVATE_KEY_PATH=… scripts/publish-update.sh [dir-with-installer] (default ../release/desktop)
|
|
#
|
|
# Sign after Authenticode signing: the updater signature covers the final file. The key's password is asked for,
|
|
# or read from TAURI_SIGNING_PRIVATE_KEY_PASSWORD. Optional NOTES: the text shown with the update. Optional
|
|
# WEBSITE_DIR: the website folder (default ../kestrove-website). Users get the update once the website is deployed.
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
DIR=${1:-../release/desktop}
|
|
SITE=${WEBSITE_DIR:-../kestrove-website}
|
|
V=$(node -p 'require("./package.json").version')
|
|
NAME="Kestrove_${V}_x64-setup.exe"
|
|
SETUP="$DIR/$NAME"
|
|
[ -f "$SETUP" ] || { echo "$SETUP not found" >&2; exit 1; }
|
|
|
|
if [ ! -f "$SETUP.sig" ]; then
|
|
: "${TAURI_SIGNING_PRIVATE_KEY_PATH:?$SETUP.sig is missing: set TAURI_SIGNING_PRIVATE_KEY_PATH to the updater key to sign it}"
|
|
# --app-version binds the signature to this version (the app requires it), so an older signed installer can't
|
|
# be offered again under a newer version number.
|
|
npx tauri signer sign -f "$TAURI_SIGNING_PRIVATE_KEY_PATH" ${TAURI_SIGNING_PRIVATE_KEY_PASSWORD+-p "$TAURI_SIGNING_PRIVATE_KEY_PASSWORD"} \
|
|
--app-version "$V" "$SETUP"
|
|
fi
|
|
|
|
mkdir -p "$SITE/downloads" "$SITE/updates"
|
|
cp "$SETUP" "$SITE/downloads/$NAME"
|
|
node -e '
|
|
const [out, v, url, sigFile, notes] = process.argv.slice(1);
|
|
const signature = require("fs").readFileSync(sigFile, "utf8").trim();
|
|
const doc = { version: v, notes, pub_date: new Date().toISOString().replace(/\.\d+Z$/, "Z"),
|
|
platforms: { "windows-x86_64": { signature, url } } };
|
|
require("fs").writeFileSync(out, JSON.stringify(doc, null, 2) + "\n");
|
|
' "$SITE/updates/latest.json" "$V" "https://kestrove.samialabri.com/downloads/$NAME" "$SETUP.sig" "${NOTES:-Kestrove $V}"
|
|
echo "Copied $NAME to $SITE/downloads and wrote $SITE/updates/latest.json. Deploy the website to offer the update."
|