Skip to content

Commit e14f48b

Browse files
committed
Update build script for publishing to master from CircleCI
This script was provided to us by Shiftlab. I modified it so we can use our bots in CircleCI to actually do the publishing. If we are ok with this script, I can do a manual run of it before turning on CircleCI to make sure it pushes the right stuff to the right place and the site works.
1 parent 6e95544 commit e14f48b

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

scripts/deploy-ghpages.sh

Lines changed: 15 additions & 14 deletions
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)