#!/usr/bin/env bash set -e BIN="./node_modules/.bin" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" VERSION=$(node -e "console.log(require('$DIR/../package.json').version)") PACKAGE=$(node -e "console.log(require('$DIR/../package.json').name)") TAG_NAME="$VERSION" TAG_EXISTS=$(git tag -l "$TAG_NAME") if [ ! -z "$TAG_EXISTS" ]; then echo "There is already a tag $TAG_EXISTS in git. Skiping git deploy." else echo "Deploying $VERSION to git" LAST_COMMIT=$(git log -1 --pretty=%B) git checkout -b dist grep -v '^build$' .gitignore > /tmp/.gitignore mv /tmp/.gitignore .gitignore git add --force build/* git commit -am "$TAG_NAME" git tag "$TAG_NAME" -m "$LAST_COMMIT" git checkout master git pull --rebase origin master git push origin $TAG_NAME git branch -D dist fi CDN_EXISTS=$(curl -s -o /dev/null -w "%{http_code}" https://cdn.auth0.com/styleguide/$VERSION/index.min.css | grep 200 || true) if [ ! -z "$CDN_EXISTS" ]; then echo "There is already a version $VERSION in the CDN. Skiping cdn publish." else echo "Deploying $VERSION to cdn" $BIN/grunt cdn fi