summaryrefslogtreecommitdiffstats
path: root/pkgs/applications/editors/vscode/update-vscodium.sh
blob: 49a92b9fb35adc4db77949aadbc3928100d80f17 (plain)
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
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash nix curl coreutils jq common-updater-scripts

set -eou pipefail

latestVersion=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL https://api.github.com/repos/VSCodium/vscodium/releases/latest | jq -r ".tag_name")
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; vscodium.version or (lib.getVersion vscodium)" | tr -d '"')
latestUpstream=$(curl -sL "https://raw.githubusercontent.com/VSCodium/vscodium/refs/tags/$latestVersion/upstream/stable.json" | jq -r ".tag")

echo "latest  version: $latestVersion"
echo "current version: $currentVersion"
echo "latest upstream version: $latestUpstream"

if [[ "$latestVersion" == "$currentVersion" ]]; then
    echo "package is up-to-date"
    exit 0
fi

for i in \
    "x86_64-linux linux-x64 tar.gz" \
    "aarch64-linux linux-arm64 tar.gz" \
    "loongarch64-linux linux-loong64 tar.gz" \
    "aarch64-darwin darwin-arm64 zip"; do
    set -- $i
    hash=$(nix --extra-experimental-features nix-command hash convert --hash-algo sha256 --to sri $(nix-prefetch-url "https://github.com/VSCodium/vscodium/releases/download/$latestVersion/VSCodium-$2-$latestVersion.$3"))
    update-source-version vscodium $latestVersion $hash --system=$1 --ignore-same-version
done

update-source-version vscodium $latestUpstream --version-key=vscodeVersion --ignore-same-version --ignore-same-hash