Files
Dark Steveneq 646b892680
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
push sheeet
2025-10-09 14:15:47 +02:00

31 lines
972 B
Bash
Executable File

#! /usr/bin/env -S nix shell nixpkgs#gnugrep nixpkgs#gnused nixpkgs#coreutils nixpkgs#curl nixpkgs#wget nixpkgs#jq nixpkgs#nix-update nixpkgs#prefetch-npm-deps nixpkgs#npm-lockfile-fix nixpkgs#nodejs --command bash
set -euo pipefail
version="$(
curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s "https://api.github.com/repos/bufbuild/protobuf-es/releases" |
jq -r 'map(select(.prerelease == false)) | .[0].tag_name' |
grep -oP "^v\K.*"
)"
url="https://raw.githubusercontent.com/bufbuild/protobuf-es/v$version/"
if [[ "$UPDATE_NIX_OLD_VERSION" == "$version" ]]; then
echo "Already up to date!"
exit 0
fi
tmp="$(mktemp -d)"
trap 'rm -rf -- "$tmp"' EXIT
pushd -- "$tmp"
wget "$url/package-lock.json"
npm-lockfile-fix package-lock.json
npm_hash=$(prefetch-npm-deps package-lock.json)
popd
pushd "$(dirname "${BASH_SOURCE[0]}")"
sed -i 's#npmDepsHash = "[^"]*"#npmDepsHash = "'"$npm_hash"'"#' package.nix
popd
nix-update protoc-gen-es --version "$version"