2021-10-17 09:34:42 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
2022-08-12 12:06:08 +00:00
|
|
|
#!nix-shell -I nixpkgs=../../../../ -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github jq
|
|
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")"
|
2021-10-17 09:34:42 +00:00
|
|
|
|
|
|
|
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
|
2022-10-21 18:38:19 +00:00
|
|
|
echo "Regenerates packaging data for the hedgedoc packages."
|
2021-10-17 09:34:42 +00:00
|
|
|
echo "Usage: $0 [git release tag]"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
version="$1"
|
|
|
|
|
|
|
|
if [ -z "$version" ]; then
|
|
|
|
version="$(wget -O- "https://api.github.com/repos/hedgedoc/hedgedoc/releases?per_page=1" | jq -r '.[0].tag_name')"
|
|
|
|
fi
|
|
|
|
|
|
|
|
src="https://raw.githubusercontent.com/hedgedoc/hedgedoc/$version"
|
2022-11-02 22:02:43 +00:00
|
|
|
|
2021-10-17 09:34:42 +00:00
|
|
|
wget "$src/package.json" -O package.json
|
2022-11-02 22:02:43 +00:00
|
|
|
wget "$src/yarn.lock" -O yarn.lock
|
2021-10-17 09:34:42 +00:00
|
|
|
|
2022-11-02 22:02:43 +00:00
|
|
|
src_old_hash=$(nix-prefetch-url --unpack "https://github.com/hedgedoc/hedgedoc/releases/download/$version/hedgedoc-$version.tar.gz")
|
|
|
|
src_hash=$(nix hash to-sri --type sha256 $src_old_hash)
|
2021-10-17 09:34:42 +00:00
|
|
|
yarn_hash=$(prefetch-yarn-deps yarn.lock)
|
|
|
|
|
2022-11-02 22:02:43 +00:00
|
|
|
sed -i "s|version = \".*\"|version = \"$version\"|" default.nix
|
|
|
|
sed -i "s|hash = \".*\"|hash = \"$src_hash\"|" default.nix
|
|
|
|
sed -i "s|sha256 = \".*\"|sha256 = \"$yarn_hash\"|" default.nix
|
|
|
|
|
|
|
|
rm yarn.lock
|