Skip to content

Commit 02c74d9

Browse files
author
Christine Abernathy
authored
Merge pull request #67 from JoelMarcey/build-script
Update build script for publishing to master from CircleCI
2 parents 6e95544 + f38ac97 commit 02c74d9

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
- image: circleci/ruby:2.5.1-node
66
branches:
77
only:
8-
- master
8+
- site
99
steps:
1010
- checkout
1111

@@ -38,5 +38,5 @@ jobs:
3838
- ~/.cache/yarn
3939

4040
- run:
41-
name: Build Jekyll site and push to gh-pages
41+
name: Build Jekyll site and push to master
4242
command: ./scripts/deploy-ghpages.sh build

scripts/deploy-ghpages.sh

+15-14
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,42 @@ pwd
1212
remote=$(git config remote.origin.url)
1313

1414
# make a directory to put the gp-pages branch
15-
mkdir gh-pages-branch
16-
cd gh-pages-branch
17-
# now lets setup a new repo so we can update the gh-pages branch
18-
git config --global user.email "$GH_EMAIL" > /dev/null 2>&1
19-
git config --global user.name "$GH_NAME" > /dev/null 2>&1
15+
mkdir master-branch
16+
cd master-branch
17+
# now lets setup a new repo so we can update the master branch
18+
git config --global user.email "facebook-circleci-bot@users.noreply.github.com" > /dev/null 2>&1
19+
git config --global user.name "Website Deployment Script" > /dev/null 2>&1
20+
echo "machine github.com login facebook-circleci-bot password $CIRCLECI_PUBLISH_TOKEN" > ~/.netrc
2021
git init
2122
git remote add --fetch origin "$remote"
2223

23-
# switch into the the gh-pages branch
24-
if git rev-parse --verify origin/gh-pages > /dev/null 2>&1
24+
# switch into the the master branch
25+
if git rev-parse --verify origin/master > /dev/null 2>&1
2526
then
26-
git checkout gh-pages
27+
git checkout master
2728
# delete any old site as we are going to replace it
2829
# Note: this explodes if there aren't any, so moving it here for now
2930
git rm -rf .
3031
else
31-
git checkout --orphan gh-pages
32+
git checkout --orphan master
3233
fi
3334

3435
cd "../"
3536
make build_deploy
36-
cd gh-pages-branch
37+
cd master-branch
3738

3839
# copy over or recompile the new site
3940
cp -a "../_site/." .
4041

4142
# stage any changes and new files
4243
git add -A
43-
# now commit, ignoring branch gh-pages doesn't seem to work, so trying skip
44+
# now commit, ignoring branch master doesn't seem to work, so trying skip
4445
git commit --allow-empty -m "Deploy to GitHub pages [ci skip]"
4546
# and push, but send any output to /dev/null to hide anything sensitive
46-
git push --force --quiet origin gh-pages
47-
# go back to where we started and remove the gh-pages git repo we made and used
47+
git push --force --quiet origin master
48+
# go back to where we started and remove the master git repo we made and used
4849
# for deployment
4950
cd ..
50-
rm -rf gh-pages-branch
51+
rm -rf master-branch
5152

5253
echo "Finished Deployment!"

0 commit comments

Comments
 (0)