-
Notifications
You must be signed in to change notification settings - Fork 46
/
.travis.yml
33 lines (33 loc) · 1022 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
32
33
language: node_js
node_js:
- '10.16.0'
install:
- npm install
before_script:
- PACKAGE_VERSION=$(npm --loglevel silent run read:version)
- TAG_FOUND=$(if GIT_DIR=$(git show-ref --tags | grep -q "refs/tags/$PACKAGE_VERSION$"); then echo true; else echo false; fi)
- npm run lint
cache:
directories:
- node_modules
deploy:
provider: npm
email: $NPM_EMAIL
api_key: $NPM_API_KEY
skip_cleanup: true
on:
condition: "$TAG_FOUND == false"
branch: master
after_deploy:
if ([ "$TRAVIS_BRANCH" == "master" ] || [ ! -z "$PACKAGE_VERSION" ]) &&
[ "$TRAVIS_PULL_REQUEST" == "false" ]; then
git config --global user.email "[email protected]";
git config --global user.name "Travis CI";
export GIT_TAG=$PACKAGE_VERSION;
git tag $GIT_TAG -a -m "Generated tag from TravisCI build $TRAVIS_BUILD_NUMBER";
git push --quiet https://$GH_TOKEN@GIT_URL > /dev/null 2>&1;
fi
# > /dev/null 2>&1 prevents key from being printed to logs
branches:
except:
- /^(\d+\.)(\d+\.)(\d+)(-\w+)?$/