-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcircle.yml
137 lines (121 loc) · 3.47 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
version: 2
node_key: &node_key
key: node-deps-v2-{{ arch }}-{{ checksum "yarn.lock" }}-{{ checksum "circle.yml" }}
restore_node: &restore_node
restore_cache:
<<: *node_key
install_node: &install_node
run:
name: node deps
command: |
if [ ! -d node_modules ]; then
yarn --pure-lockfile
fi
save_node: &save_node
save_cache:
<<: *node_key
paths:
- node_modules
container_defaults: &defaults
docker:
- image: circleci/node:10-browsers
environment:
JOBS: 2
jobs:
install:
<<: *defaults
steps:
- checkout
- <<: *restore_node
- <<: *install_node
- <<: *save_node
test:
<<: *defaults
environment:
CIRCLE_TEST_REPORTS: test-results
steps:
- checkout
- <<: *restore_node
- run:
name: Lint Styles
command: yarn run lint:styles
- run:
name: Run Ember Tests
command: npx ember test
- store_test_results:
path: test-results/
build-storybook:
<<: *defaults
steps:
- checkout
- <<: *restore_node
- run:
name: Build Ember
command: npx ember build
- run:
name: Build Docs
command: |
[[ $CIRCLE_BRANCH = "main" ]] && RELEASE="latest" || { [[ -n $CIRCLE_BRANCH ]] && RELEASE=$CIRCLE_BRANCH || RELEASE=$CIRCLE_TAG; }
npm run build-storybook -- -o storybook-static/$RELEASE
cp index.html storybook-config.json storybook-static/
- persist_to_workspace:
root: .
paths:
- storybook-static
deploy-storybook-to-s3:
<<: *defaults
steps:
- checkout
- <<: *restore_node
- attach_workspace:
at: .
- run:
name: Disable jekyll builds
command: touch storybook-static/.nojekyll
- run:
name: Install AWSCLI
command: |
sudo curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
sudo unzip awscliv2.zip
sudo ./aws/install
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
aws configure set default.region $AWS_DEFAULT_REGION
- run:
name: Deploy docs to aws s3
command: |
[[ $CIRCLE_BRANCH = "main" ]] && RELEASE="latest" || { [[ -n $CIRCLE_BRANCH ]] && RELEASE=$CIRCLE_BRANCH || RELEASE=$CIRCLE_TAG; }
yarn storybook-to-aws-s3 --bucket-path=$S3_BUCKET/$RELEASE -e=./storybook-static/$RELEASE
aws s3 cp storybook-static/index.html s3://$S3_BUCKET
aws s3 cp storybook-static/storybook-config.json s3://$S3_BUCKET
AWS_PAGER="" aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_ID --paths "/index.html" "/storybook-config.json" "/$RELEASE/*"
workflows:
version: 2
just-test:
jobs:
- install:
filters:
branches:
ignore: main
- test:
requires:
- install
deploy-storybook-to-s3:
jobs:
- install:
filters:
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+/
branches:
only:
- main
- /qa\/.*/
- test:
requires:
- install
- build-storybook:
requires:
- test
- deploy-storybook-to-s3:
requires:
- build-storybook