-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
31 lines (23 loc) · 941 Bytes
/
.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
language: node_js
node_js:
- '8.1'
cache:
directories:
- node_modules
before_script:
- export NODE_ENV="test"
- export VERSION="$(node -p -e "require('./package').version")-$TRAVIS_BUILD_NUMBER"
- export MESSAGE="$VERSION $(git log --format=%B --no-merges -n 1)"
- export VERSION="${VERSION//[^[:alnum:]^-]}"
- export ENVIRONMENT="$(node -p -e "JSON.parse('{\"master\":\"prod\",\"develop\":\"stag\"}').${TRAVIS_BRANCH:-undefined} || ''")"
- if [[ "$ENVIRONMENT" ]]; then
export PROJECT="$(node -p -e "require('./environment/config').$ENVIRONMENT.projectId")";
fi
- if [[ "$PROJECT" ]]; then
export DEPLOY="$(node -p -e "/\[deploy\]/.test('$MESSAGE')")";
fi
- echo BRANCH=${TRAVIS_BRANCH:-undefined}$'\n'MESSAGE=${MESSAGE:-undefined}$'\n'ENVIRONMENT=${ENVIRONMENT:-undefined}$'\n'PROJECT=${PROJECT:-undefined}$'\n'VERSION=${VERSION:-undefined}
after_success:
- if [[ "$DEPLOY" = true ]]; then
npm run deploy;
fi