forked from WoWAnalyzer/WoWAnalyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
50 lines (50 loc) · 1.65 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
language: node_js
services:
- docker
node_js:
- 9.3.0
cache:
directories:
- node_modules
- server/node_modules
env:
- NODE_ENV=production
before_install:
- npm i -g [email protected]
install:
- npm install
- cd server && npm install --dev && cd ..
before_script:
- export AUTHOR_NAME="$(git log -1 $TRAVIS_COMMIT --pretty="%aN")"
- export BRANCH_OR_PR="$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo "PR-$TRAVIS_PULL_REQUEST"; fi)"
- export SOURCE_URL="$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo "https://github.com/"$REPO_OWNER"/"$REPO_NAME"/commit/"$TRAVIS_COMMIT""; else echo "https://github.com/"$REPO_OWNER"/"$REPO_NAME"/pull/"$TRAVIS_PULL_REQUEST""; fi)"
script:
- npm test
- npm run build
- cd server && npm run build && cd ..
after_success:
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
cd server;
echo "The server has already been built so we no longer need the devDependencies";
npm prune --production;
cd ..;
export REPO=martijnhols/wowanalyzer;
export BRANCH=$(
if [ "$TRAVIS_BRANCH" == "master" ]; then
echo "latest";
else
echo $TRAVIS_BRANCH;
fi | sed -r 's/\//-/g'
);
echo "#docker build";
docker build --tag $REPO:$BRANCH --file Dockerfile.package .;
echo "#docker login";
docker login --username="$DOCKER_USERNAME" --password="$DOCKER_PASSWORD";
echo "#docker push";
docker push $REPO:$BRANCH;
fi
# - chmod +x travis-discord-hook/success.sh
# - ./travis-discord-hook/success.sh
after_failure:
- chmod +x travis-discord-hook/fail.sh
- ./travis-discord-hook/fail.sh