|
12 | 12 | remote=$(git config remote.origin.url)
|
13 | 13 |
|
14 | 14 | # 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 |
20 | 21 | git init
|
21 | 22 | git remote add --fetch origin "$remote"
|
22 | 23 |
|
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 |
25 | 26 | then
|
26 |
| - git checkout gh-pages |
| 27 | + git checkout master |
27 | 28 | # delete any old site as we are going to replace it
|
28 | 29 | # Note: this explodes if there aren't any, so moving it here for now
|
29 | 30 | git rm -rf .
|
30 | 31 | else
|
31 |
| - git checkout --orphan gh-pages |
| 32 | + git checkout --orphan master |
32 | 33 | fi
|
33 | 34 |
|
34 | 35 | cd "../"
|
35 | 36 | make build_deploy
|
36 |
| -cd gh-pages-branch |
| 37 | +cd master-branch |
37 | 38 |
|
38 | 39 | # copy over or recompile the new site
|
39 | 40 | cp -a "../_site/." .
|
40 | 41 |
|
41 | 42 | # stage any changes and new files
|
42 | 43 | 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 |
44 | 45 | git commit --allow-empty -m "Deploy to GitHub pages [ci skip]"
|
45 | 46 | # 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 |
48 | 49 | # for deployment
|
49 | 50 | cd ..
|
50 |
| -rm -rf gh-pages-branch |
| 51 | +rm -rf master-branch |
51 | 52 |
|
52 | 53 | echo "Finished Deployment!"
|
0 commit comments