1 #!/usr/bin/env nix-shell
2 #!nix-shell -I nixpkgs=../../../../ -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github jq
4 # shellcheck shell=bash
6 if [ -n "$GITHUB_TOKEN" ]; then
7 TOKEN_ARGS
=(--header "Authorization: token $GITHUB_TOKEN")
10 if [ "$#" -gt 1 ] ||
[[ "$1" == -* ]]; then
11 echo "Regenerates packaging data for the tandoor-recipes package."
12 echo "Usage: $0 [git release tag]"
20 if [ -z "$version" ]; then
21 version
="$(wget -O- "${TOKEN_ARGS[@]}" "https
://api.github.com
/repos
/TandoorRecipes
/recipes
/releases?per_page
=1" | jq -r '.[0].tag_name')"
24 package_src
="https://raw.githubusercontent.com/TandoorRecipes/recipes/$version"
26 src_hash
=$
(nix-prefetch-github TandoorRecipes recipes
--rev "${version}" | jq
-r .
hash)
29 trap 'rm -rf "$tmpdir"' EXIT
32 wget
"${TOKEN_ARGS[@]}" "$package_src/vue/yarn.lock"
33 yarn_hash
=$
(prefetch-yarn-deps yarn.lock
)
36 # Use friendlier hashes
37 yarn_hash
=$
(nix
hash to-sri
--type sha256
"$yarn_hash")
39 sed -i -E -e "s#version = \".*\"#version = \"$version\"#" common.nix
40 sed -i -E -e "s#hash = \".*\"#hash = \"$src_hash\"#" common.nix
41 sed -i -E -e "s#yarnHash = \".*\"#yarnHash = \"$yarn_hash\"#" common.nix