forked from auth0/styleguide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy
More file actions
executable file
·37 lines (31 loc) · 1.1 KB
/
Copy pathdeploy
File metadata and controls
executable file
·37 lines (31 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/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 v4
git pull --rebase origin v4
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