bottom: add gpu recognition, new apple sdk, refactor (#360568)
[NixPkgs.git] / pkgs / by-name / pr / protoc-gen-connect-es / update.sh
blob6306267da77fdc05448f82b10c78f3077711aa52
1 #! /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
3 set -euo pipefail
5 version="$(
6 curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s "https://api.github.com/repos/connectrpc/connect-es/releases" |
7 jq -r 'map(select(.prerelease == false)) | .[0].tag_name' |
8 grep -oP "^v\K.*"
9 )"
10 url="https://raw.githubusercontent.com/connectrpc/connect-es/v$version/"
12 if [[ "$UPDATE_NIX_OLD_VERSION" == "$version" ]]; then
13 echo "Already up to date!"
14 exit 0
17 tmp="$(mktemp -d)"
18 trap 'rm -rf -- "$tmp"' EXIT
20 pushd -- "$tmp"
21 wget "$url/package-lock.json"
22 npm-lockfile-fix package-lock.json
23 npm_hash=$(prefetch-npm-deps package-lock.json)
24 popd
26 pushd "$(dirname "${BASH_SOURCE[0]}")"
27 sed -i 's#npmDepsHash = "[^"]*"#npmDepsHash = "'"$npm_hash"'"#' package.nix
28 popd
30 nix-update protoc-gen-connect-es --version "$version"