UNPKG

1.95 kBYAMLView Raw
1version: 2
2jobs:
3 build:
4 docker:
5 - image: circleci/node:4
6
7
8 working_directory: ~/kes
9 steps:
10 - checkout
11
12 # restore cache
13 - restore_cache:
14 keys:
15 - deploy-{{ .Branch }}-{{ checksum "package.json" }}
16
17 - run:
18 name: Install
19 command: |
20 npm install
21 sudo npm install -g .
22
23 - run:
24 name: Test Examples
25 command: |
26 mkdir ~/example1
27 cp -r examples/lambdas ~/example1/.kes
28 cd ~/example1/
29 kes cf compile
30 kes cf validate
31
32 cd ~/kes
33 kes cf compile --kes-folder examples/full
34 kes cf validate --kes-folder examples/full
35
36 kes cf validate --kes-folder examples/app_using_template --template examples/template
37
38 npm run test
39
40 - add_ssh_keys:
41 fingerprints:
42 - "8f:58:d1:7d:1f:b0:ed:cc:fd:c9:46:cb:ee:6b:40:86"
43 - run:
44 name: docs
45 command: |
46 if [ "${CIRCLE_BRANCH}" == "master" ]; then
47 cd ~/kes
48 npm run html-docs
49 cd _docs
50 git init
51 git config user.name "Devseed-CI"
52 git config user.email "dev@developmentseed.org"
53 git add .
54 git commit -m "CI deploy [skip ci]"
55 git remote add origin git@github.com:developmentseed/kes.git
56 git push origin master:gh-pages --force
57 fi
58
59 - run:
60 name: Deploy
61 command: |
62 if [ "${CIRCLE_BRANCH}" == "master" ]; then
63 cd ~/kes
64 echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
65 npm publish || echo 'npm publishing failed'
66 fi
67
68 # save cahce
69 - save_cache:
70 key: deploy-{{ .Branch }}-{{ checksum "package.json" }}
71 paths:
72 - ~/kes/node_modules