-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
41 lines (32 loc) · 1.35 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
language: node_js
node_js:
- '8.1'
cache:
directories:
- node_modules
before_install:
- openssl aes-256-cbc -K $encrypted_9b82b4442b13_key -iv $encrypted_9b82b4442b13_iv -in environment/private.tar.enc -out environment/private.tar -d
- mkdir environment/private && tar xvf environment/private.tar -C environment/private
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/private/travis.server.$ENVIRONMENT.key').project_id")";
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}
deploy:
- provider: gae
skip_cleanup: true
keyfile: environment/private/travis.server.$ENVIRONMENT.key.json
config: server.$ENVIRONMENT.yml
project: $PROJECT
version: $VERSION
on:
all_branches: true
condition: "$DEPLOY = true"