2023-10-22 17:53:50 +02:00
|
|
|
#!/usr/bin/env nix-shell
|
2024-02-15 18:25:59 +01:00
|
|
|
#! nix-shell -i bash -p curl jq common-updater-scripts prefetch-npm-deps nodejs
|
2023-10-22 17:53:50 +02:00
|
|
|
set -eou pipefail
|
|
|
|
|
2024-02-15 18:25:59 +01:00
|
|
|
pkgDir="$(dirname "$(readlink -f "$0")")"
|
|
|
|
|
2023-10-22 17:53:50 +02:00
|
|
|
tempDir=$(mktemp -d)
|
|
|
|
|
|
|
|
ghTags=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/Vendicated/Vencord/tags")
|
|
|
|
latestTag=$(echo "$ghTags" | jq -r .[0].name)
|
|
|
|
gitHash=$(echo "$ghTags" | jq -r .[0].commit.sha)
|
|
|
|
|
|
|
|
pushd "$tempDir"
|
|
|
|
curl "https://raw.githubusercontent.com/Vendicated/Vencord/$latestTag/package.json" -o package.json
|
|
|
|
npm install --legacy-peer-deps -f
|
|
|
|
|
|
|
|
npmDepsHash=$(prefetch-npm-deps ./package-lock.json)
|
|
|
|
popd
|
|
|
|
|
|
|
|
update-source-version vencord "${latestTag#v}"
|
|
|
|
|
2024-04-18 13:15:29 +02:00
|
|
|
sed -E 's#\bgitHash = ".*?"#gitHash = "'"${gitHash:0:7}"'"#' -i "$pkgDir/package.nix"
|
|
|
|
sed -E 's#\bnpmDepsHash = ".*?"#npmDepsHash = "'"$npmDepsHash"'"#' -i "$pkgDir/package.nix"
|
2024-02-15 18:25:59 +01:00
|
|
|
cp "$tempDir/package-lock.json" "$pkgDir/package-lock.json"
|