Skip to content

Commit 882d485

Browse files
author
Sergei Orlov
committed
ci(travis): add CI/CD configuration
1 parent efcaa16 commit 882d485

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

.travis.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- "12"
5+
cache:
6+
directories:
7+
- node_modules
8+
9+
stages:
10+
- check
11+
- name: cover
12+
if: branch = master AND type != push
13+
- name: versioning
14+
if: branch = master AND type != push
15+
- name: publish
16+
if: tag IS present AND tag =~ ^v AND type != push
17+
18+
jobs:
19+
include:
20+
- stage: check
21+
script:
22+
- npm run lint
23+
- npm run test
24+
- stage: cover
25+
script:
26+
- npm run test:cover
27+
- bash <(curl -s https://codecov.io/bash) -t "${CODECOV_TOKEN}" -f coverage/*.json
28+
- stage: versioning
29+
script:
30+
- npm install -g @priestine/semantics
31+
- priestine-semantics --private-token=${SEMANTICS_TOKEN} --project-path=Raini-js/switch --prefix=v
32+
- stage: publish
33+
script:
34+
- bash deploy_npm.sh

deploy_npm.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Add version to package.json
2+
sed -i s/"\"version\":.*/\"version\": \"${TRAVIS_TAG}\","/ package.json
3+
4+
# Install dependencies
5+
npm run build
6+
7+
# Put NPM access token to .npmrc for publishing
8+
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
9+
10+
# Publish new version of the app to NPM
11+
npm publish

0 commit comments

Comments
 (0)