-
Notifications
You must be signed in to change notification settings - Fork 41
/
config.yml
57 lines (50 loc) · 1.55 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
version: 2
jobs:
deploy:
docker:
- image: circleci/node:10
working_directory: ~/repo
environment:
- SOURCE_BRANCH: master
- TARGET_BRANCH: gh-pages
steps:
- checkout
- restore_cache:
keys:
- v2-dependencies-{{ checksum "package-lock.json" }}
- v2-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v2-dependencies-{{ checksum "package-lock.json" }}
- run: npm test
- run: npm run build
- deploy:
name: Deploy to Github Pages
command: |
if [ $CIRCLE_BRANCH == $SOURCE_BRANCH ]; then
git config --global user.email $GH_EMAIL
git config --global user.name $GH_NAME
git clone https://${GH_TOKEN}@github.com/developersdo/opensource.git out
cd out
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
git rm -rf .
cd ..
cp -a public/. out/.
mkdir -p out/.circleci && cp -a .circleci/. out/.circleci/.
cd out
git add -A
git commit -m "Deployed: website to Github Pages (automatic): ${CIRCLE_SHA1}" --allow-empty
git push -q https://${GH_TOKEN}@github.com/developersdo/opensource.git $TARGET_BRANCH
fi
workflows:
version: 2
deploy:
jobs:
- deploy:
filters:
branches:
ignore:
- gh-pages
- master