acr-cli: init at 0.14 (#359508)
[NixPkgs.git] / pkgs / by-name / ma / matrix-hookshot / update.sh
blob4092abf9bc1478964de169052510e2ad70bc1389
1 #!/usr/bin/env -S nix shell nixpkgs#nix nixpkgs#curl nixpkgs#jq nixpkgs#prefetch-yarn-deps nixpkgs#nix-prefetch-github nixpkgs#nix-prefetch-git --command bash
3 if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
4 echo "Regenerates packaging data for matrix-hookshot."
5 echo "Usage: $0 [git release tag]"
6 exit 1
7 fi
9 version="$1"
11 set -euo pipefail
13 if [ -z "$version" ]; then
14 version="$(curl "https://api.github.com/repos/matrix-org/matrix-hookshot/releases?per_page=1" | jq -r '.[0].tag_name')"
17 src="https://raw.githubusercontent.com/matrix-org/matrix-hookshot/$version"
18 src_hash=$(nix-prefetch-github matrix-org matrix-hookshot --rev ${version} | jq -r .hash)
20 tmpdir=$(mktemp -d)
21 trap 'rm -rf "$tmpdir"' EXIT
23 pushd $tmpdir
24 curl -O "$src/yarn.lock"
25 yarn_hash=$(prefetch-yarn-deps yarn.lock)
26 popd
28 curl -O "$src/package.json"
29 # There is no prefetcher for the cargo hash, but care should still be taken to update it
30 cat > pin.json << EOF
32 "version": "$version",
33 "srcHash": "$src_hash",
34 "yarnHash": "$yarn_hash",
35 "cargoHash": "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
37 EOF