1 #!/usr/bin/env nix-shell
2 #!nix-shell -I nixpkgs=./. -i bash -p curl jq nix-prefetch common-updater-scripts nix coreutils
3 # shellcheck shell=bash
6 RELEASE_NAME
=$
(curl
-s https
://api.github.com
/repos
/infisical
/infisical
/releases \
7 | jq
-r 'sort_by(.created_at) | reverse |
9 (select ((.prerelease == false) and (.draft == false) and (.name | contains("infisical-cli")))) |
12 VERSION
=$
(echo "$RELEASE_NAME" |
sed -E 's/^infisical-cli\/v//')
14 echo "Latest infisical release: $VERSION"
17 "x86_64-linux:linux_amd64"
18 "x86_64-darwin:darwin_amd64"
19 "aarch64-linux:linux_arm64"
20 "aarch64-darwin:darwin_arm64"
23 NFILE
=pkgs
/development
/tools
/infisical
/default.nix
24 HFILE
=pkgs
/development
/tools
/infisical
/hashes.json
25 rm -f "$HFILE" && touch "$HFILE"
27 printf "{ \"_comment\": \"@generated by pkgs/development/tools/infisical/update.sh\"\n" >> "$HFILE"
29 for arch
in "${ARCHS[@]}"; do
30 IFS
=: read -r arch_name arch_target
<<< "$arch"
31 sha256hash
="$(nix-prefetch-url --type sha256 "https
://github.com
/infisical
/infisical
/releases
/download
/${RELEASE_NAME}/infisical_${VERSION}_${arch_target}.
tar.gz
")"
32 srihash
="$(nix hash to-sri --type sha256 "$sha256hash")"
33 echo ", \"$arch_name\": \"$srihash\"" >> "$HFILE"
38 '0,/version\s*=\s*".*";/s//version = "'"$VERSION"'";/' \
41 echo "Done; wrote $HFILE and updated version in $NFILE."