-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.travis.yml
53 lines (48 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
language: node_js
node_js: 18
cache: false
dist: focal
jobs:
include:
- stage: install, check code style and coverage
if: tag IS blank
services:
- mongodb
addons:
hosts:
- localhost
- dev-controller
- kubernetes.default
before_script:
- npm install -g grunt-cli
script:
- if [ "$TRAVIS_BRANCH" != "master" ]; then grunt test; fi
- if [ "$TRAVIS_BRANCH" = "master" ]; then grunt coverage; fi
- stage: Publish to npm
if: branch =~ /(release)/
script:
- echo "PUBLISH npm"
deploy:
provider: npm
email: $NPM_EMAIL
api_key: $NPM_TOKEN
on:
all_branches: true
condition: $TRAVIS_BRANCH =~ ^(release)*
- stage: Tag and release
if: branch =~ /(release)/
script:
- echo "Tagging"
- export PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -Fn '{ print $2 }' | sed 's/[n:",]//g' | tr -d '[[:space:]]')
- export MAJOR_VERSION=$(echo ${PACKAGE_VERSION} | awk -F. '{ print $1 }')
- echo Package version ${PACKAGE_VERSION}
- echo Major version ${MAJOR_VERSION}
- git config --local user.name ${GIT_USER}
- git config --local user.email ${GIT_EMAIL}
- git tag ${PACKAGE_VERSION}
deploy:
on:
all_branches: true
provider: releases
api_key: ${GIT_TOKEN}
skip_cleanup: true