api-ui/scripts/upload

28 lines
547 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}"
TARBALL="dist/${VERSION}.tar.gz"
CDN="releases.rancher.com/api-ui"
echo "Uploading..."
exec gsutil -m cp -R -z "js,css,map" $BUILD_DIR "gs://${CDN}/"
exec gsutil -m cp -R -z "js,css,map" $TARBALL "gs://${CDN}/"