Skip to content

Commit 23568a1

Browse files
author
Ben Grynhaus
committed
gh-pages change in Circle CI
1 parent eb89456 commit 23568a1

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

.circleci/config.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
version: 2
22
jobs:
33
build:
4+
ignore:
5+
- gh-pages
46
docker:
57
# specify the version you desire here
68
- image: circleci/node:10-browsers
7-
89
working_directory: ~/repo
9-
1010
steps:
1111
- checkout
1212

@@ -46,9 +46,10 @@ jobs:
4646
docker:
4747
# specify the version you desire here
4848
- image: circleci/node:10-browsers
49-
5049
working_directory: ~/repo
51-
50+
environment:
51+
- SOURCE_BRANCH: master
52+
- TARGET_BRANCH: gh-pages
5253
steps:
5354
- add_ssh_keys:
5455
fingerprints:
@@ -80,9 +81,26 @@ jobs:
8081
if [ "${CIRCLE_BRANCH}" == "master" ]; then
8182
git config user.name "CircleCI"
8283
git config user.email "circleci@users.noreply.github.com"
84+
85+
git clone $CIRCLE_REPOSITORY_URL out
86+
87+
cd out
88+
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
89+
git rm -rf .
90+
cd ..
91+
92+
npm run build
93+
94+
cp -a build/. out/.
95+
96+
mkdir -p out/.circleci && cp -a .circleci/. out/.circleci/.
97+
cd out
98+
8399
git add -A
84-
git commit -m 'Deploy to GitHub pages [ci]'
85-
git push
100+
git commit -m "Automated deployment to GitHub Pages: ${CIRCLE_SHA1}" --allow-empty
101+
102+
git push origin $TARGET_BRANCH
103+
86104
fi
87105
workflows:
88106
version: 2

0 commit comments

Comments
 (0)