trilium-desktop: manage electron version in update script

This commit is contained in:
éclairevoyant
2026-03-06 09:03:57 -05:00
parent 9f2cd1e02d
commit 418289e250
+8 -2
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p coreutils curl jq
#!nix-shell -i bash -p coreutils curl jq gnused
set -euo pipefail
cd $(dirname "${BASH_SOURCE[0]}")
@@ -8,7 +8,11 @@ setKV () {
sed -i "s|$2 = \".*\"|$2 = \"${3:-}\"|" $1
}
version=$(curl -s --show-error "https://api.github.com/repos/TriliumNext/Trilium/releases/latest" | jq -r '.tag_name' | tail -c +2)
curl_github() {
curl -s --show-error -L ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "$@"
}
version=$(curl_github "https://api.github.com/repos/TriliumNext/Trilium/releases/latest" | jq -r '.tag_name' | tail -c +2)
setKV ./package.nix version $version
# Update desktop application
@@ -20,6 +24,8 @@ setKV ./package.nix x86_64-linux.hash $sha256_linux64
setKV ./package.nix aarch64-linux.hash $sha256_linux64_arm
setKV ./package.nix x86_64-darwin.hash $sha256_darwin64
setKV ./package.nix aarch64-darwin.hash $sha256_darwin64_arm
electronVersion=$(curl_github "https://raw.githubusercontent.com/TriliumNext/Trilium/v$version/apps/desktop/package.json" | jq -r ".devDependencies.electron" | sed -r 's|^\^?([0-9]+).*|\1|')
sed -r "s|(electron_)[0-9]+|\1$electronVersion|" -i ./package.nix
# Update server
sha256_linux64_server=$(nix store prefetch-file --json --hash-type sha256 https://github.com/TriliumNext/Trilium/releases/download/v${version}/TriliumNotes-Server-v${version}-linux-x64.tar.xz | jq -r .hash)