1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p curl gojq nix-prefetch-github common-updater-scripts
5 pkg_dir
="$(dirname "$0")"
8 curl
--silent ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "$1"
11 version
="$(gh-curl "https
://api.github.com
/repos
/ente-io
/ente
/releases
" | gojq 'map(select(.draft == false and .prerelease == false and (.tag_name | startswith("auth-v
")))) | first | .tag_name' --raw-output)"
12 short_version
="${version:6}"
13 if [[ "$short_version" == "$UPDATE_NIX_OLD_VERSION" ]]; then
14 echo "ente-auth is already up-to-date: $short_version"
17 echo "Updating to $short_version"
19 # Subtree needed for lockfile and icons
20 auth_tree
="$(gh-curl "https
://api.github.com
/repos
/ente-io
/ente
/git
/trees
/$version" | gojq '.tree[] | select(.path == "auth
") | .url' --raw-output)"
22 # Get lockfile, filter out incompatible sqlite dependency and convert to JSON
23 echo "Updating lockfile"
24 pubspec_lock
="$(gh-curl "$auth_tree" | gojq '.tree[] | select(.path == "pubspec.lock
") | .url' --raw-output)"
25 gh-curl
"$pubspec_lock" | gojq
'.content | @base64d' --raw-output | gojq
--yaml-input 'del(.packages.sqlite3_flutter_libs)' > "$pkg_dir/pubspec.lock.json"
27 # Get rev and hash of simple-icons submodule
29 assets_tree
="$(gh-curl "$auth_tree" | gojq '.tree[] | select(.path == "assets
") | .url' --raw-output)"
30 simple_icons_rev
="$(gh-curl "$assets_tree" | gojq '.tree[] | select(.path == "simple-icons
") | .sha' --raw-output)"
31 nix-prefetch-github
--rev "$simple_icons_rev" simple-icons simple-icons
> "$pkg_dir/simple-icons.json"
33 # Update package version and hash
34 echo "Updating package source"
35 update-source-version ente-auth
"$short_version" --file="$pkg_dir/package.nix"