File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 branches :
66 ignore :
77 - gh-pages
8- - master
98 docker :
109 - image : circleci/node:10
11-
12- working_directory : ~/repo
13-
14- steps :
15- - checkout
16- - restore_cache :
17- keys :
18- - v1-dependencies-{{ checksum "package.json" }}
19- - v1-dependencies-
20- - run : npm install
21- - save_cache :
22- paths :
23- - node_modules
24- key : v1-dependencies-{{ checksum "package.json" }}
25- - run : npm test
26- - run : npm run build
27-
28- deploy :
29- branches :
30- only :
31- - master
32-
33- docker :
34- - image : circleci/node:10
35-
3610 working_directory : ~/repo
37-
3811 environment :
3912 - SOURCE_BRANCH : master
4013 - TARGET_BRANCH : gh-pages
41-
4214 steps :
4315 - checkout
4416 - restore_cache :
@@ -53,21 +25,23 @@ jobs:
5325 - run : npm test
5426 - run : npm run build
5527 - deploy :
56- name : Deploy
28+ name : Deploy to Github Pages
5729 command : |
58- git config --global user.email $GH_EMAIL
59- git config --global user.name $GH_NAME
30+ if [ $CIRCLE_BRANCH == $SOURCE_BRANCH ]; then
31+ git config --global user.email $GH_EMAIL
32+ git config --global user.name $GH_NAME
6033
61- git clone $CIRCLE_REPOSITORY_URL out
34+ git clone $CIRCLE_REPOSITORY_URL out
6235
63- cd out
64- git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
65- git rm -rf .
66- cd ..
36+ cd out
37+ git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
38+ git rm -rf .
39+ cd ..
6740
68- cp -a public/. out/.
41+ cp -a public/. out/.
6942
70- cd out
71- git add -A
72- git commit -m "Deployed: website to Github Pages (automatic): ${CIRCLE_SHA1}" --allow-empty
73- git push -q https://${GH_TOKEN}@github.com/developersdo/opensource.git $TARGET_BRANCH
43+ cd out
44+ git add -A
45+ git commit -m "Deployed: website to Github Pages (automatic): ${CIRCLE_SHA1}" --allow-empty
46+ git push -q https://${GH_TOKEN}@github.com/developersdo/opensource.git $TARGET_BRANCH
47+ fi
You can’t perform that action at this time.
0 commit comments