From 68be4dd915cbe8698b502f39e40b8ac7393c9387 Mon Sep 17 00:00:00 2001 From: Sumedha Pramod Date: Thu, 2 Nov 2017 15:43:21 -0700 Subject: [PATCH] New: Add script to upgrade box-annotations version in Preview --- build/upgrade_annotations.sh | 69 ++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 70 insertions(+) create mode 100755 build/upgrade_annotations.sh diff --git a/build/upgrade_annotations.sh b/build/upgrade_annotations.sh new file mode 100755 index 000000000..b0a89343e --- /dev/null +++ b/build/upgrade_annotations.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +export NODE_PATH=$NODE_PATH:./node_modules + +update_version() { + CURRENT_VERSION="$(cat package.json | grep box-annotations | sed 's/.*\^\(.*\)\".*/\1/')"; + LATEST_VERSION="$(npm show box-annotations version)"; + + yarn add box-annotations@^$LATEST_VERSION + + UPDATED_VERSION="$(cat package.json | grep box-annotations | sed 's/.*\^\(.*\)\".*/\1/')"; + + if [ $UPDATED_VERSION == $LATEST_VERSION ]; then + echo "----------------------------------------------------------------------" + echo "Successfully upgraded from $CURRENT_VERSION to $UPDATED_VERSION" + echo "----------------------------------------------------------------------" + else + echo "----------------------------------------------------------------------" + echo "Error: Failed to upgrade to $CURRENT_VERSION" + echo "----------------------------------------------------------------------" + fi +} + +get_changelog() { + CHANGELOG="$(curl https://raw.githubusercontent.com/box/box-annotations/master/CHANGELOG.md | awk '/\#/{f=1} f{print; if (/\