Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
40 lines
1.5 KiB
Bash
Executable File
40 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env nix-shell
|
|
#!nix-shell -i bash -p curl common-updater-scripts coreutils jq prefetch-yarn-deps git
|
|
|
|
set -euo pipefail
|
|
set -x
|
|
|
|
cd "$(git rev-parse --show-toplevel)"
|
|
|
|
TMPDIR=$(mktemp -d)
|
|
|
|
echo "Getting versions..."
|
|
latestVersion="$(curl -sL "https://api.github.com/repos/the-draupnir-project/Draupnir/releases?per_page=1" | jq -r '.[0].tag_name | ltrimstr("v")')"
|
|
echo " --> Latest version: ${latestVersion}"
|
|
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; draupnir.version or (lib.getVersion draupnir)" | tr -d '"')
|
|
echo " --> Current version: ${currentVersion}"
|
|
if [[ "$currentVersion" == "$latestVersion" ]]; then
|
|
echo "Draupnir is up-to-date: $currentVersion"
|
|
exit 0
|
|
else
|
|
echo "We are out of date..."
|
|
fi
|
|
|
|
curl https://raw.githubusercontent.com/the-draupnir-project/Draupnir/v$latestVersion/package.json -o pkgs/by-name/dr/draupnir/package.json
|
|
|
|
update-source-version draupnir "$latestVersion"
|
|
|
|
# Update yarn offline cache hash
|
|
cd $TMPDIR
|
|
|
|
curl https://raw.githubusercontent.com/the-draupnir-project/Draupnir/v$latestVersion/yarn.lock -o yarn.lock
|
|
TMP_PREFETCH_HASH=`prefetch-yarn-deps yarn.lock`
|
|
NEW_YARN_OFFLINE_HASH=`nix --extra-experimental-features nix-command hash to-sri --type sha256 $TMP_PREFETCH_HASH`
|
|
|
|
cd -
|
|
echo "New yarn offline hash: $NEW_YARN_OFFLINE_HASH"
|
|
|
|
TMPFILE=$(mktemp)
|
|
jq '.yarn_offline_cache_hash = "'$NEW_YARN_OFFLINE_HASH'"' pkgs/by-name/dr/draupnir/hashes.json > $TMPFILE
|
|
mv -- "$TMPFILE" pkgs/by-name/dr/draupnir/hashes.json
|