From 7de9e4a1fb39f0304ee006e40c4e15e1a17a308f Mon Sep 17 00:00:00 2001 From: Sumedha Pramod Date: Sun, 5 Nov 2017 19:34:30 -0800 Subject: [PATCH] New: Add script to upgrade box-annotations version in Preview (#468) --- 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 (/\