api-ui/scripts/upload

26 lines
431 B
Bash
Executable File

#!/bin/bash
set -e
# cd to app root
CWD=$(dirname $0)
if [ `basename $(pwd)` = 'scripts' ]; then
cd ../
else
cd `dirname $CWD`
fi
function exec() {
$@
if [ $? -ne 0 ]; then
echo "Command: $@ failed"
exit 2
fi
}
VERSION=$(cat package.json | grep version | cut -f4 -d'"' | sed 's/-/_/g')
BUILD_DIR="dist/${VERSION}"
CDN="cdn.rancher.io/api-ui"
echo "Uploading..."
exec gsutil -m cp -R $BUILD_DIR "gs://${CDN}/"