forked from auth0/styleguide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
63 lines (44 loc) · 1.25 KB
/
Copy pathrelease.sh
File metadata and controls
63 lines (44 loc) · 1.25 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
set -e
#
# Release script
# Export RELEASE env var
export RELEASE=1
# Verifies that is running from the right directory
if ! [ -e tools/scripts/release.sh ]; then
echo >&2 "Please run tools/scripts/release.sh from the repo root"
exit 1
fi
# git origin of destination
GIT_ORIGIN_DEST="origin"
# git branch of destination
GIT_BRANCH_DEST="master"
# Package name
PACKAGE_NAME=$(node -p "require('./package').name")
# Package version
PACKAGE_VERSION=$(node -p "require('./package').version")
# Test before start the release process
echo "Testing $PACKAGE_VERSION"
# npm test
# Publish to our CDN
echo "Deploying $PACKAGE_VERSION to our CDN"
$(npm bin)/gulp cdn
$(npm bin)/ccu
# Publish to npm
echo "Deploying $PACKAGE_VERSION to npm"
NPM_EXISTS=$(npm info $PACKAGE_NAME@$PACKAGE_VERSION)
if [ "$NPM_EXISTS" == "undefined" ]; then
npm publish
else
echo "There is already a version $PACKAGE_VERSION in npm. Skiping npm publish."
fi
# Publish git tag
echo "Deploying $PACKAGE_VERSION git tag"
TAG_NAME="$PACKAGE_NAME-v$PACKAGE_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 tag deploy."
else
git tag $TAG_NAME
git push $GIT_ORIGIN_DEST $TAG_NAME
fi