2021-10-28 12:29:27 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -I nixpkgs=../../../../../ -i bash -p nix wget prefetch-yarn-deps nix-prefetch-git jq
|
|
|
|
|
2022-02-25 12:56:23 +00:00
|
|
|
if [[ "$#" -gt 2 || "$1" == -* ]]; then
|
2021-10-28 12:29:27 +00:00
|
|
|
echo "Regenerates packaging data for the SchildiChat packages."
|
2022-02-25 12:56:23 +00:00
|
|
|
echo "Usage: $0 [git revision or tag] [version string override]"
|
2021-10-28 12:29:27 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-02-25 12:56:23 +00:00
|
|
|
rev="$1"
|
|
|
|
version="$2"
|
2021-10-28 12:29:27 +00:00
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
2022-02-25 12:56:23 +00:00
|
|
|
if [ -z "$rev" ]; then
|
|
|
|
rev="$(wget -O- "https://api.github.com/repos/SchildiChat/schildichat-desktop/releases?per_page=1" | jq -r '.[0].tag_name')"
|
2021-10-28 12:29:27 +00:00
|
|
|
fi
|
|
|
|
|
2022-02-25 12:56:23 +00:00
|
|
|
if [ -z "$version" ]; then
|
|
|
|
# strip leading "v"
|
|
|
|
version="${rev#v}"
|
|
|
|
fi
|
2021-10-28 12:29:27 +00:00
|
|
|
|
2022-02-25 12:56:23 +00:00
|
|
|
src_data=$(nix-prefetch-git https://github.com/SchildiChat/schildichat-desktop --fetch-submodules --rev $rev)
|
2021-10-28 12:29:27 +00:00
|
|
|
src=$(echo $src_data | jq -r .path)
|
|
|
|
src_hash=$(echo $src_data | jq -r .sha256)
|
|
|
|
|
|
|
|
web_yarn_hash=$(prefetch-yarn-deps $src/element-web/yarn.lock)
|
|
|
|
desktop_yarn_hash=$(prefetch-yarn-deps $src/element-desktop/yarn.lock)
|
|
|
|
|
|
|
|
cat > pin.json << EOF
|
|
|
|
{
|
|
|
|
"version": "$version",
|
2022-02-25 12:56:23 +00:00
|
|
|
"rev": "$rev",
|
2021-10-28 12:29:27 +00:00
|
|
|
"srcHash": "$src_hash",
|
|
|
|
"webYarnHash": "$web_yarn_hash",
|
|
|
|
"desktopYarnHash": "$desktop_yarn_hash"
|
|
|
|
}
|
|
|
|
EOF
|