forked from nypublicradio/themes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
81 lines (71 loc) · 2.09 KB
/
circle.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
version: 2
jobs:
install:
docker:
- image: circleci/node:8.7
steps:
- checkout
- restore_cache:
key: node-deps-{{ checksum "package-lock.json" }}-{{ checksum "package.json" }}
- run:
name: Install node dependencies
command: npm i --no-package-lock
- save_cache:
key: node-deps-{{ checksum "package-lock.json" }}-{{ checksum "package.json" }}
paths:
- ./node_modules
test:
docker:
- image: circleci/node:8.7-browsers
steps:
- checkout
- restore_cache:
key: node-deps-{{ checksum "package-lock.json" }}-{{ checksum "package.json" }}
- run:
name: Test
command: npm test
deploy:
docker:
- image: circleci/node:8.7
steps:
- checkout
- restore_cache:
key: node-deps-{{ checksum "package-lock.json" }}-{{ checksum "package.json" }}
- run:
name: Install aws cli
command: sudo apt-get -y -qq install awscli
- run:
name: Theme files and index
command: |
if [[ "${CIRCLE_BRANCH}" == "master" ]]; then
export AWS_BUCKET=$DEMO_AWS_BUCKET
export AWS_PREFIX=$DEMO_AWS_PREFIX
elif grep -q "v[0-9]\+\.[0-9]\+\.[0-9]\+" <<< "$CIRCLE_TAG"; then
export AWS_BUCKET=$PROD_AWS_BUCKET
export AWS_PREFIX=$PROD_AWS_PREFIX
fi
npm run generate
aws s3 cp ./index.json s3://"$AWS_BUCKET"/"$AWS_PREFIX"/ --cache-control "max-age=0, no-cache"
aws s3 sync ./json/ s3://"$AWS_BUCKET"/"$AWS_PREFIX" --cache-control "max-age=0, no-cache"
workflows:
version: 2
install-test-deploy:
jobs:
- install:
filters:
tags:
only: /.*/
- test:
filters:
tags:
only: /.*/
requires:
- install
- deploy:
requires:
- test
filters:
tags:
only: /^v[0-9]\.[0-9]\.[0-9]+/
branches:
only: master