aux-config/packages/olympus/update.sh
kB01 ea9cb70b19
Some checks failed
/ Check Nix Flake (push) Has been cancelled
Added Olympus Mod-loader Installer for Celeste
2025-04-11 23:01:05 +02:00

32 lines
897 B
Bash

#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts nixfmt-rfc-style
set -eu -o pipefail
attr=olympus
nix_file=$(nix-instantiate --eval --strict -A "$attr.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/')
api() {
curl -s "https://dev.azure.com/EverestAPI/Olympus/_apis/$1?api-version=7.1"
}
pipeline_id=$(api pipelines | jq -r '
.value
| map(select(.name == "EverestAPI.Olympus"))
| .[0].id
')
run_id=$(api pipelines/$pipeline_id/runs | jq -r '
.value
| map(select(.result == "succeeded"))
| max_by(.finishedDate)
| .id
')
sed -i 's|buildId\s*=\s*".*";|buildId = "'$run_id'";|' $nix_file
run=$(api pipelines/$pipeline_id/runs/$run_id)
commit=$(echo "$run" | jq -r '.resources.repositories.self.version')
version=$(echo "$run" | jq -r '.name')
update-source-version $attr $version --rev=$commit
"$(nix-build --attr $attr.fetch-deps --no-out-link)"