From 13b1ff28bb459214d8d1208c99ed1e5b9f350747 Mon Sep 17 00:00:00 2001 From: Jannis Metrikat <120120832+jmetrikat@users.noreply.github.com> Date: Wed, 16 Aug 2023 16:59:44 +0200 Subject: [PATCH] =?UTF-8?q?DROID=20App=20|=C2=A0Tech=20|=20Improve=20updat?= =?UTF-8?q?e.mw.sh=20(#255)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/mw/update-mw.sh | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/scripts/mw/update-mw.sh b/scripts/mw/update-mw.sh index 3edb13d423..c81faa29d5 100755 --- a/scripts/mw/update-mw.sh +++ b/scripts/mw/update-mw.sh @@ -4,15 +4,6 @@ REPO="anyproto/anytype-heart" FILE="lib.tar.gz" GITHUB="api.github.com" -echo "Enter your github token (check your github.properties file)" - -read -r TOKEN - -if [ "$TOKEN" = "" ]; then - echo "ERROR: token is empty" - exit 1 -fi; - echo "Enter MW version without any prefix (for instance: 0.26.0)" read -r MW_VERSION @@ -22,12 +13,12 @@ if [ "$MW_VERSION" = "" ]; then exit 1 fi; -version=`curl -H "Authorization: token $TOKEN" -H "Accept: application/vnd.github.v3+json" -sL https://$GITHUB/repos/$REPO/releases/tags/v$MW_VERSION | jq .` +version=`curl -H "Accept: application/vnd.github.v3+json" -sL https://$GITHUB/repos/$REPO/releases/tags/v$MW_VERSION | jq .` tag=`echo $version | jq ".tag_name"` asset_id=`echo $version | jq ".assets | map(select(.name | match(\"android_lib_\";\"i\")))[0].id"` -if [ "$asset_id" = "null" ]; then +if [[ "$asset_id" = "null" || "$asset_id" = "" ]]; then echo "ERROR: version not found" exit 1 fi; @@ -35,7 +26,7 @@ fi; printf "Version: $tag\n" printf "Found asset: $asset_id\n" echo -n "Downloading file... " -curl -sL -H 'Accept: application/octet-stream' https://$TOKEN:@$GITHUB/repos/$REPO/releases/assets/$asset_id > $FILE +curl -sL -H 'Accept: application/octet-stream' https://$GITHUB/repos/$REPO/releases/assets/$asset_id > $FILE printf "Done\n" echo -n "Uncompressing... "