2021-11-14 21:19:26 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
2022-08-22 20:50:30 +01:00
|
|
|
#!nix-shell -I nixpkgs=../../../.. -i bash -p curl gnused jq common-updater-scripts
|
|
|
|
set -euo pipefail
|
2021-11-14 21:19:26 +00:00
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
|
|
|
2022-08-22 20:50:30 +01:00
|
|
|
deps_file="$(realpath ./deps.nix)"
|
2021-11-14 21:19:26 +00:00
|
|
|
|
|
|
|
new_version="$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s "https://api.github.com/repos/JustArchiNET/ArchiSteamFarm/releases" | jq -r 'map(select(.prerelease == false)) | .[0].tag_name')"
|
|
|
|
old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)"
|
|
|
|
|
|
|
|
if [[ "$new_version" == "$old_version" ]]; then
|
|
|
|
echo "Already up to date!"
|
2022-08-22 20:50:30 +01:00
|
|
|
if [[ "${1-default}" != "--deps-only" ]]; then
|
2022-05-15 11:44:08 +01:00
|
|
|
exit 0
|
|
|
|
fi
|
2021-11-14 21:19:26 +00:00
|
|
|
fi
|
|
|
|
|
2022-06-06 01:12:53 +01:00
|
|
|
asf_path=$(pwd)
|
2021-11-14 21:19:26 +00:00
|
|
|
cd ../../../..
|
2022-05-15 11:44:08 +01:00
|
|
|
|
|
|
|
nixpkgs_path=$(pwd)
|
2022-06-06 00:33:03 +01:00
|
|
|
if [[ "${1:-}" != "--deps-only" ]]; then
|
2022-05-15 11:44:08 +01:00
|
|
|
update-source-version ArchiSteamFarm "$new_version"
|
|
|
|
fi
|
2022-06-06 01:13:29 +01:00
|
|
|
|
2022-08-22 20:50:30 +01:00
|
|
|
$(nix-build -A ArchiSteamFarm.fetch-deps --no-out-link) "$deps_file"
|
2021-11-14 21:19:26 +00:00
|
|
|
|
2022-06-06 01:12:53 +01:00
|
|
|
cd "$asf_path"
|
|
|
|
./web-ui/update.sh
|