895da4caae
- This also takes into account the transfer of the project and repository to the matrix-org organisation on GitHub. - The Node version assertion has been removed because our `pkgs.nodejs` already points to version 18. - This replaces the `.nix` lock file (generated with `yarn2nix`) with a hash-pinned fixed-output derivation, which is simpler to work with. - This replaces the old "generate.sh" script with one that updates all the version info and hashes (package.json, source version, source hash, and Yarn dependencies hash). This is inspired by the update script used for the "matrix-appservice-slack" package. - This switches to srcOnly for node sources. - Added pkgs.matrix-sdk-crypto-nodejs new required native dependency.
43 lines
925 B
Bash
Executable File
43 lines
925 B
Bash
Executable File
#!/usr/bin/env nix-shell
|
|
#!nix-shell -I nixpkgs=../../../ -i bash -p nix curl jq prefetch-yarn-deps nix-prefetch-github
|
|
|
|
ORG="matrix-org"
|
|
PROJ="matrix-appservice-discord"
|
|
|
|
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
|
|
echo "Regenerates packaging data for $PROJ."
|
|
echo "Usage: $0 [git release tag]"
|
|
exit 1
|
|
fi
|
|
|
|
tag="$1"
|
|
|
|
set -euo pipefail
|
|
|
|
if [ -z "$tag" ]; then
|
|
tag="$(
|
|
curl "https://api.github.com/repos/$ORG/$PROJ/releases?per_page=1" |
|
|
jq -r '.[0].tag_name'
|
|
)"
|
|
fi
|
|
|
|
src="https://raw.githubusercontent.com/$ORG/$PROJ/$tag"
|
|
src_sha256=$(nix-prefetch-github $ORG $PROJ --rev ${tag} | jq -r .sha256)
|
|
|
|
tmpdir=$(mktemp -d)
|
|
trap 'rm -rf "$tmpdir"' EXIT
|
|
|
|
pushd $tmpdir
|
|
curl -O "$src/yarn.lock"
|
|
yarn_sha256=$(prefetch-yarn-deps yarn.lock)
|
|
popd
|
|
|
|
curl -O "$src/package.json"
|
|
cat > pin.json << EOF
|
|
{
|
|
"version": "$(echo $tag | grep -P '(\d|\.)+' -o)",
|
|
"srcSha256": "$src_sha256",
|
|
"yarnSha256": "$yarn_sha256"
|
|
}
|
|
EOF
|