forked from react/react-native-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.yml
More file actions
137 lines (126 loc) · 3.58 KB
/
Copy pathconfig.yml
File metadata and controls
137 lines (126 loc) · 3.58 KB
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.1
# -------------------------
# EXECUTORS
# -------------------------
executors:
node:
docker:
- image: circleci/node:lts
# -------------------------
# COMMANDS
# -------------------------
commands:
restore_cache_checkout:
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
run_yarn:
steps:
- restore_cache:
keys:
- v1-yarn-{{ .Branch }}
- run:
name: Yarn Install
command: yarn install --no-progress --non-interactive --cache-folder ~/.cache/yarn
- save_cache:
paths:
- node_modules
- ~/.cache/yarn
key: v1-yarn-{{ .Branch }}
# -------------------------
# JOBS
# -------------------------
jobs:
# --------------------------------------------------
# JOB: setup
# Checks out the repo, and persists to cache.
# --------------------------------------------------
setup:
executor: node
working_directory: ~/react-native-website
steps:
- checkout
- save_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/react-native-website
# --------------------------------------------------
# JOB: test
# Test that the website can be built.
# --------------------------------------------------
test:
executor: node
working_directory: ~/react-native-website/website
steps:
- restore_cache_checkout
- run_yarn
- run: yarn ci-check
- run: yarn test
- run:
name: Check for missing index.html (build errors)
command: |
if [ ! -f build/index.html ]; then
exit 1;
fi
# --------------------------------------------------
# JOB: lint
# Lint the docs.
# --------------------------------------------------
language_lint:
executor: node
working_directory: ~/react-native-website/website
steps:
- restore_cache_checkout
- run_yarn
- run: yarn lint
# --------------------------------------------------
# JOB: deploy_website
# Deploy website to GitHub Pages in core RN repo.
# --------------------------------------------------
deploy_website:
executor: node
working_directory: ~/react-native-website/website
steps:
- restore_cache_checkout
- run_yarn
- run: sudo apt install rsync
- run:
name: Build and Deploy Static Website
command: |
if [[ $CIRCLE_PROJECT_USERNAME == "facebook" && -z $CI_PULL_REQUEST && -z $CIRCLE_PR_USERNAME ]]; then
git config --global user.email "reactjs-bot@users.noreply.github.com"
git config --global user.name "Website Deployment Script"
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
echo "Deploying website..."
export NODE_OPTIONS=--max_old_space_size=4096
GIT_USER=reactjs-bot CIRCLE_PROJECT_REPONAME=react-native yarn run publish-gh-pages
else
echo "Skipping deploy."
fi
# -------------------------
# WORKFLOWS
# -------------------------
workflows:
# Tests run on master and on forks
tests:
jobs:
- setup
# Run tests
- test:
requires:
- setup
# Run lints
- language_lint:
requires:
- setup
# If we are on master, deploy docs
deploy:
jobs:
- setup:
filters:
branches:
only:
- master
- deploy_website:
requires:
- setup