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]"
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)
21 trap 'rm -rf "$tmpdir"' EXIT
24 curl
-O "$src/yarn.lock"
25 yarn_hash
=$
(prefetch-yarn-deps yarn.lock
)
28 curl
-O "$src/package.json"
29 # There is no prefetcher for the cargo hash, but care should still be taken to update it
32 "version": "$version",
33 "srcHash": "$src_hash",
34 "yarnHash": "$yarn_hash",
35 "cargoHash": "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="