nixpkgs/pkgs/by-name/we/webcord/update.sh
2024-05-04 02:22:31 -04:00

15 lines
643 B
Bash
Executable file

#! /usr/bin/env nix-shell
#! nix-shell -i bash -p curl jq nix-update
set -ex
curl_github() {
curl -L ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "$@"
}
latestTag=$(curl_github https://api.github.com/repos/SpacingBat3/Webcord/releases/latest | jq -r ".tag_name")
latestVersion="$(expr "$latestTag" : 'v\(.*\)')"
nix-update --version "$latestVersion" webcord
electronVersion=$(curl_github "https://raw.githubusercontent.com/SpacingBat3/WebCord/v$latestVersion/package.json" | jq -r ".devDependencies.electron" | sed -r 's|^\^([0-9]+).*|\1|')
sed -r "/webcord = / s|(electron_)[0-9]+|\1$electronVersion|" -i pkgs/top-level/all-packages.nix