forked from MetaMask/metamask-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
99 lines (94 loc) · 2.27 KB
/
config.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
version: 2.1
workflows:
test-and-deploy:
jobs:
- prep-deps
- lint:
requires:
- prep-deps
- build:
requires:
- prep-deps
- lint
- deploy:
filters:
branches:
only:
- master
requires:
- prep-deps
- lint
- build
jobs:
prep-deps:
docker:
- image: circleci/node:12
steps:
- checkout
- run:
name: Install deps
command: |
yarn --frozen-lockfile --ignore-scripts
- persist_to_workspace:
root: .
paths:
- node_modules
lint:
docker:
- image: circleci/node:12
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Lint
command: |
yarn lint
build:
docker:
- image: circleci/node:12
environment:
- TARGET_BRANCH: gh-pages
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Build
command: |
if [[ "$CIRCLE_BRANCH" == "master" ]]
then
if [[ -z "$ALGOLIA_API_KEY" || -z "$ALGOLIA_INDEX_NAME" ]]
then
printf '%s\n' 'ERROR: Algolia API key or index name not set.' >&2
exit 1
fi
else
printf '%s\n' 'Non-main build does not require Algolia API key or index name'
fi
yarn build
- persist_to_workspace:
root: .
paths:
- docs/dist/
deploy:
docker:
- image: circleci/node:12
environment:
- TARGET_BRANCH: gh-pages
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Deploy site
command: |
git config --global user.email $GH_EMAIL
git config --global user.name $GH_NAME
git checkout $TARGET_BRANCH
rm -rf `ls -a | grep "[^.|..|.git|.nojekyll|docs|LICENSE|CNAME|index.html]"`
cp -r docs/dist/* .
rm -rf docs
git add -A
git commit -m "Automated deployment: ${CIRCLE_SHA1} [ci skip]" --allow-empty
git push -f origin $TARGET_BRANCH