vscode-extensions.capatech.betacode: init at 0.1.10 (#355720)
[NixPkgs.git] / pkgs / servers / matrix-synapse / matrix-appservice-slack / update.sh
blobdc3bab3311f21c6becd0191772657a7a8bdda19e
1 #!/usr/bin/env nix-shell
2 #!nix-shell -I nixpkgs=../../../../ -i bash -p nix curl jq prefetch-yarn-deps nix-prefetch-github nix-prefetch-git
4 if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
5 echo "Regenerates packaging data for matrix-appservice-slack."
6 echo "Usage: $0 [git release tag]"
7 exit 1
8 fi
10 version="$1"
12 set -euo pipefail
14 if [ -z "$version" ]; then
15 version="$(curl "https://api.github.com/repos/matrix-org/matrix-appservice-slack/releases?per_page=1" | jq -r '.[0].tag_name')"
18 src="https://raw.githubusercontent.com/matrix-org/matrix-appservice-slack/$version"
19 src_hash=$(nix-prefetch-github matrix-org matrix-appservice-slack --rev ${version} | jq -r .hash)
21 tmpdir=$(mktemp -d)
22 trap 'rm -rf "$tmpdir"' EXIT
24 pushd $tmpdir
25 curl -O "$src/yarn.lock"
26 yarn_hash=$(prefetch-yarn-deps yarn.lock)
27 popd
29 curl -O "$src/package.json"
30 cat > pin.json << EOF
32 "version": "$version",
33 "srcHash": "$src_hash",
34 "yarnHash": "$yarn_hash"
36 EOF