Skip to content

Commit a7debd1

Browse files
committed
add CI config
1 parent 36b305a commit a7debd1

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.circleci/config.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
version: 2
2+
jobs:
3+
test:
4+
docker:
5+
- image: circleci/node:8.15-browsers
6+
steps:
7+
- checkout
8+
- restore_cache:
9+
keys:
10+
- v1-dependencies-{{ checksum "package.json" }}
11+
- v1-dependencies-
12+
- run: yarn
13+
- run: yarn test
14+
- run: yarn build
15+
- save_cache:
16+
paths:
17+
- node_modules
18+
key: v1-dependencies-{{ checksum "package.json" }}
19+
deploy_stage:
20+
docker:
21+
- image: circleci/node:8.15-browsers
22+
steps:
23+
- checkout
24+
- run: sudo apt update && sudo apt install awscli
25+
- run: yarn
26+
- run: yarn build
27+
- run: sudo npm i -g npm-cli-login
28+
- run: NPM_USER=$NPM_USERNAME NPM_EMAIL=$NPM_EMAIL NPM_PASS=$NPM_PASSWORD npm-cli-login
29+
- run: npm publish --dry-run
30+
- run: gzip -9 /home/circleci/project/dist/iife/onboard.js
31+
- run: mv /home/circleci/project/dist/iife/onboard.js.gz /home/circleci/project/dist/iife/onboard.js
32+
- run: ls -al
33+
- run: echo export VERSION=`awk '/version/{gsub(/("|",)/,"",$2);print $2};' package.json | sed 's/\./-/g'` >> $BASH_ENV
34+
- run: mkdir /home/circleci/project/deploy-temp
35+
- run: mkdir /home/circleci/project/deploy-temp/${VERSION}
36+
- run: mv /home/circleci/project/dist/iife/*.js /home/circleci/project/deploy-temp/${VERSION}/
37+
- run: aws s3 sync /home/circleci/project/deploy-temp/${VERSION}/ s3://staging.onboard.blocknative.com/${VERSION}/ --content-type "text/javascript" --content-encoding "gzip" --cache-control "max-age=31536000" --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
38+
deploy_prod:
39+
docker:
40+
- image: circleci/node:8.15-browsers
41+
steps:
42+
- checkout
43+
- run: sudo apt update && sudo apt install awscli
44+
- run: yarn
45+
- run: yarn build
46+
- run: sudo npm i -g add npm-cli-login
47+
- run: NPM_USER=$NPM_USERNAME NPM_EMAIL=$NPM_EMAIL NPM_PASS=$NPM_PASSWORD npm-cli-login
48+
- run: npm publish
49+
- run: gzip -9 /home/circleci/project/dist/iife/onboard.js
50+
- run: mv /home/circleci/project/dist/iife/onboard.js.gz /home/circleci/project/dist/iife/onboard.js
51+
- run: ls -al
52+
- run: echo export VERSION=`awk '/version/{gsub(/("|",)/,"",$2);print $2};' package.json | sed 's/\./-/g'` >> $BASH_ENV
53+
- run: mkdir /home/circleci/project/deploy-temp
54+
- run: mkdir /home/circleci/project/deploy-temp/${VERSION}
55+
- run: mv /home/circleci/project/dist/iife/*.js /home/circleci/project/deploy-temp/${VERSION}/
56+
- run: aws s3 sync /home/circleci/project/deploy-temp/${VERSION}/ s3://onboard.blocknative.com/${VERSION}/ --content-type "text/javascript" --content-encoding "gzip" --cache-control "max-age=31536000" --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
57+
workflows:
58+
version: 2
59+
test_build:
60+
jobs:
61+
- test
62+
- deploy_stage:
63+
requires:
64+
- test
65+
filters:
66+
branches:
67+
only:
68+
- develop
69+
- deploy_prod:
70+
requires:
71+
- test
72+
filters:
73+
branches:
74+
only:
75+
- master

0 commit comments

Comments
 (0)