From 210adbf766baeb50a08b1953561807520489f996 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Thu, 29 Sep 2022 20:44:16 +0200 Subject: [PATCH] tool: Add script to automatically update components --- tool/update.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 tool/update.sh diff --git a/tool/update.sh b/tool/update.sh new file mode 100755 index 00000000..c62dc8d2 --- /dev/null +++ b/tool/update.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -euxo pipefail +cd "$(dirname "$0")/.." + +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")" + yes | fvm use --force "$flutter_version@$flutter_channel" || true + dart_version="$(fvm flutter --version --machine | jq -r ".dartSdkVersion")" + dart_version_major="$(echo "$dart_version" | cut -d "." -f 1)" + dart_version_minor="$(echo "$dart_version" | cut -d "." -f 2)" + dart_version_next_major=$(( dart_version_major + 1 )) + sed -i "s/flutter-version: '.*'/flutter-version: '$flutter_version'/" .github/workflows/fdroid-nightly.yaml + sed -i "s/channel: '.*'/channel: '$flutter_channel'/" .github/workflows/fdroid-nightly.yaml + 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 +else + echo "$1 not found" + exit 1 +fi \ No newline at end of file