1#!/usr/bin/env nix-shell
2#!nix-shell -i bash -p yq nix bash coreutils nix-update common-updater-scripts ripgrep flutter
3
4set -euo pipefail
5
6PACKAGE_DIR=$(realpath "$(dirname "$0")")
7
8latestVersion=$(
9 list-git-tags --url=https://github.com/doraemonkeys/WindSend |
10 rg '^v(.*)' -r '$1' |
11 sort --version-sort |
12 tail -n1
13)
14
15currentVersion=$(nix eval --raw --file . windsend.version)
16
17[[ $currentVersion == $latestVersion ]] && {
18 echo "package is up-to-date: $currentVersion"
19 exit 0
20}
21
22nix-update --version=$latestVersion windsend
23
24src=$(nix build --no-link --print-out-paths .#windsend.src)
25source=$(mktemp -d)
26cp -r --no-preserve=mode "$src/"* "$source"
27pushd "$source/flutter/wind_send"
28flutter pub get
29yq . pubspec.lock >"$PACKAGE_DIR/pubspec.lock.json"
30popd
31rm -rf "$source"
32./update-gitHashes.py