forked from experdot/general-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
55 lines (46 loc) · 1.34 KB
/
.travis.yml
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
language: node_js
node_js:
- "10"
branches:
only:
- master
env:
global:
- Remote_Repository: github.com/experdot/general-engine.git
- Deployment_Folder: repository_ghpages
cache:
directories:
- $HOME/.npm
# Start: Build LifeCycle
install:
# install npm packages
- npm install
script:
# gulp
- gulp default --env production
# check if gh-pages branch exists (token is required if origin is private)
- export BRANCH_EXISTS=$(git ls-remote --heads https://${GitHubToken}@${Remote_Repository} gh-pages)
- echo $BRANCH_EXISTS
# create or clone repository
- if [ -n $BRANCH_EXISTS ]; then
git init ${Deployment_Folder};
cd ${Deployment_Folder};
git checkout -b gh-pages;
cd ../;
else
git clone --depth=1 --branch=gh-pages https://${GitHubToken}@${Remote_Repository} ${Deployment_Folder};
cd ${Deployment_Folder};
git checkout gh-pages;
rm -rf *;
cd ../;
fi
# move distributing files
- mv ./dist/* ${Deployment_Folder}
after_success:
- if [ "$TRAVIS_EVENT_TYPE" = "push" ]; then
cd ${Deployment_Folder};
git add --force .;
git commit -m "Deploy from $TRAVIS_BRANCH $TRAVIS_COMMIT. Travis-CI Build No.$TRAVIS_BUILD_NUMBER";
git push --force "https://${GitHubToken}@${Remote_Repository}" gh-pages:gh-pages;
fi
# End: Build LifeCycle