diff --git a/scripts/install_latest_artifact.sh b/scripts/install_latest_artifact.sh new file mode 100755 index 00000000..99359558 --- /dev/null +++ b/scripts/install_latest_artifact.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -eu + +BUILD_NUM=`curl -s 'https://circleci.com/api/v1.1/project/github/GitJournal/GitJournal?limit=1&offset=0&filter=completed' | jq .[0] | jq -r .build_num` +echo "CircleCI Buld Number: $BUILD_NUM" + +URL=`curl -s https://circleci.com/api/v1.1/project/github/GitJournal/GitJournal/$BUILD_NUM/artifacts | jq .[0] | jq -r .url` +APK_LOCATION="/tmp/gitjournal.apk" + +echo "Downloading $URL" +curl "$URL" -o "$APK_LOCATION" + +adb uninstall io.gitjournal.gitjournal +adb install -r "$APK_LOCATION"