From 70e0fcc00e571653e78ecf2e6f016c34708bbdce Mon Sep 17 00:00:00 2001 From: jld3103 Date: Thu, 29 Sep 2022 21:25:52 +0200 Subject: [PATCH] tool: Enable updating apps automatically --- tool/update.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tool/update.sh b/tool/update.sh index c62dc8d2..ecad5ebf 100755 --- a/tool/update.sh +++ b/tool/update.sh @@ -2,6 +2,16 @@ set -euxo pipefail cd "$(dirname "$0")/.." +function update_app() { + name="$1" + ( + cd "external/nextcloud-$name" + git fetch --tags + latest_tag="$(git tag --sort=v:refname | grep -vi "rc" | grep -vi "alpha" | grep -vi "beta" | tail -n 1)" + git reset --hard "$latest_tag" + ) +} + if [[ "$1" == "flutter" ]]; then flutter_channel="stable" flutter_version="$(curl https://raw.githubusercontent.com/fluttertools/fvm/main/releases_linux.json | jq -r "[.releases[] | select(.channel==\"$flutter_channel\")][0].version")" @@ -15,6 +25,8 @@ if [[ "$1" == "flutter" ]]; then find ./packages -name "pubspec.yaml" -exec sed -i "s/flutter: '>=.*'/flutter: '>=$flutter_version'/" {} \; find ./packages -name "pubspec.yaml" -exec sed -i "s/sdk: '>=.* <.*'/sdk: '>=$dart_version_major.$dart_version_minor.0 <$dart_version_next_major.0.0'/" {} \; fvm exec mono_repo pub get +elif [ -d "external/nextcloud-$1" ]; then + update_app "$1" else echo "$1 not found" exit 1