-
Notifications
You must be signed in to change notification settings - Fork 4
/
.travis.yml
66 lines (56 loc) · 1.93 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
56
57
58
59
60
61
62
63
64
65
66
language: node_js
notifications:
email: false
node_js:
- "12.18.2"
services:
- redis-server
before_script:
- cp -a .env.example .env
before_install:
- if [ "$TRAVIS_BRANCH" == "master" ]; then
openssl aes-256-cbc -K $encrypted_d810adeb7664_key -iv $encrypted_d810adeb7664_iv
-in .travis/deploy_key.enc -out .travis/deploy_key -d;
fi
install: npm install
jobs:
include:
# Run all tasks
- stage: Tests
if: |
branch = develop AND \
tag IS blank AND \
commit_message !~ /(no-deploy|wip)/
script:
- npm run lint
- npm run test:coverage
- npm run test:coveralls
after_success:
- wget https://raw.githubusercontent.com/calendz/travis-discord-webhook/master/send.sh
- chmod +x send.sh
- ./send.sh success $DISCORD_WEBHOOK_URL
after_failure:
- wget https://raw.githubusercontent.com/calendz/travis-discord-webhook/master/send.sh
- chmod +x send.sh
- ./send.sh failure $DISCORD_WEBHOOK_URL
# Build and push both versionned and current versions
- stage: Build Docker image
if: branch = master
script:
- "PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')"
- echo "==== Building calendz/api-calendar:$PACKAGE_VERSION ===="
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker build -t calendz/api-calendar .
- docker images
- docker tag calendz/api-calendar calendz/api-calendar:current
- docker tag calendz/api-calendar calendz/api-calendar:${PACKAGE_VERSION}
- docker push calendz/api-calendar:current
- docker push calendz/api-calendar:${PACKAGE_VERSION}
# Deploy latest API-CALENDAR version
- stage: Deploy
if: branch = master
script:
- sh .travis/deploy.sh
cache:
directories:
- node_modules