forked from ionic-team/ionic-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci.sh
executable file
·130 lines (102 loc) · 3.75 KB
/
ci.sh
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
# Task that runs every time CI server is pushed to
ARG_DEFS=(
)
function init {
# If we are on travis, set our git credentials to make the travis commits look better
if [[ "$TRAVIS" == "true" ]]; then
git config --global user.name 'Ionotron'
git config --global user.email [email protected]
export GH_ORG=driftyco
export RELEASE_REMOTE=origin
else
# For testing if we aren't on travis
export TRAVIS_BUILD_NUMBER=$RANDOM
export TRAVIS_PULL_REQUEST=false
export TRAVIS_COMMIT=$(git rev-parse HEAD)
export TRAVIS_BRANCH=master
# use your github username as GH_ORG to push to, and it will push to ORG/ionic-code, etc
export GH_ORG=ajoslin
export RELEASE_REMOTE=ajoslin
fi
}
function run {
cd ../..
echo "GH_ORG=$GH_ORG"
echo "RELEASE_REMOTE=$RELEASE_REMOTE"
echo "TRAVIS_BRANCH=$TRAVIS_BRANCH"
echo "TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER"
echo "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST"
echo "TRAVIS_COMMIT=$TRAVIS_COMMIT"
# check for stupid mistakes
gulp ddescribe-iit
# Run simple quick tests on Phantom to be sure any tests pass
# Tests are run on cloud browsers after build
gulp karma --browsers=PhantomJS --reporters=dots
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
echo "-- This is a pull request build; will not push build out."
exit 0
fi
mkdir -p tmp
git show $TRAVIS_COMMIT~1:package.json > tmp/package.old.json
OLD_VERSION=$(readJsonProp "tmp/package.old.json" "version")
OLD_CODENAME=$(readJsonProp "tmp/package.old.json" "codename")
VERSION=$(readJsonProp "package.json" "version")
CODENAME=$(readJsonProp "package.json" "codename")
if [[ "$OLD_VERSION" != "$VERSION" ]]; then
IS_RELEASE=true
echo "#######################################"
echo "# Releasing v$VERSION \"$CODENAME\"! #"
echo "#######################################"
else
if [[ "$TRAVIS_BRANCH" != "master" ]]; then
echo "-- We are not on branch master, instead we are on branch $TRAVIS_BRANCH. Aborting build."
exit 0
fi
echo "#####################################"
echo "# Pushing out a new nightly release #"
echo "#####################################"
./scripts/travis/bump-nightly-version.sh
VERSION=$(readJsonProp "package.json" "version")
CODENAME=$(readJsonProp "package.json" "codename")
fi
# Build files after we are sure our version is correct
gulp build --release
if [[ $IS_RELEASE == "true" ]]; then
./scripts/travis/release-new-version.sh \
--codename=$CODENAME \
--version=$VERSION
# Version name used on the CDN/docs: nightly or the version
VERSION_NAME=$VERSION
./scripts/site/publish.sh --action="clone"
./scripts/site/publish.sh --action="updateConfig"
./scripts/seed/publish.sh --version="$VERSION"
else
./scripts/site/publish.sh --action="clone"
VERSION_NAME="nightly"
fi
./scripts/site/publish.sh \
--action="docs" \
--version-name="$VERSION_NAME"
./scripts/cdn/publish.sh \
--version=$VERSION \
--version-name="$VERSION_NAME"
./scripts/bower/publish.sh \
--version="$VERSION" \
--codename="$CODENAME"
if [[ "$IS_RELEASE" == "true" ]]; then
echo "################################################"
echo "# Complete! v$VERSION \"$CODENAME\" published! #"
echo "################################################"
else
echo "##########################"
echo "# Running cloud tests... #"
echo "##########################"
# Do sauce unit tests and e2e tests with all browsers (takes longer)
# gulp cloudtest
echo "##########################################"
echo "# Complete! v$VERSION nightly published! #"
echo "##########################################"
fi
}
source $(dirname $0)/../utils.inc