summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/me/melonloader-installer/update.sh
blob: 90d36c637dc22ba84134ce3232dc0fdecf3f85d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i bash -p curl jq common-updater-scripts
#shellcheck shell=bash

# Implementation lovingly referenced and adapted from cavalier package's update.sh

set -eu -o pipefail

version=$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
    https://api.github.com/repos/LavaGang/MelonLoader.Installer/releases/latest | jq -e -r .tag_name)
old_version=$(nix-instantiate --eval --raw -A melonloader-installer.version)

if [[ $version == "$old_version" ]]; then
    echo "New version same as old version, nothing to do." >&2
    exit 0
fi

update-source-version melonloader-installer "$version"

$(nix-build -A melonloader-installer.fetch-deps --no-out-link) "$(dirname -- "${BASH_SOURCE[0]}")/deps.json"