From cee81d7c4a8b7f24b5f6c10934fce61d39990ef6 Mon Sep 17 00:00:00 2001 From: Vishesh Handa <me@vhanda.in> Date: Wed, 13 Feb 2019 14:19:21 +0100 Subject: [PATCH] Add a helper script to get the latest artifact from CircleCI --- scripts/install_latest_artifact.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 scripts/install_latest_artifact.sh 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"