github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/tools/website/web-deploy.sh (about) 1 #!/bin/sh 2 set -e 3 4 # show where we are on the machine 5 pwd 6 7 remote=$(git config remote.origin.url) 8 siteSource="website/public/" 9 GH_EMAIL="ci@cortexmetrics.io" 10 GH_NAME="ci" 11 12 # make a directory to put the gp-pages branch 13 mkdir gh-pages-branch 14 cd gh-pages-branch 15 # now lets setup a new repo so we can update the gh-pages branch 16 git config --global user.email "$GH_EMAIL" > /dev/null 2>&1 17 git config --global user.name "$GH_NAME" > /dev/null 2>&1 18 git init 19 git remote add --fetch origin "$remote" 20 21 # switch into the gh-pages branch 22 if git rev-parse --verify origin/gh-pages > /dev/null 2>&1 23 then 24 git checkout gh-pages 25 # delete any old site as we are going to replace it 26 # Note: this explodes if there aren't any, so moving it here for now 27 git rm -rf . 28 else 29 git checkout --orphan gh-pages 30 fi 31 32 # copy over or recompile the new site 33 cp -a "../${siteSource}/." . 34 # set github CNAME file. 35 echo "cortexmetrics.io" > CNAME 36 37 # stage any changes and new files 38 git add -A 39 git commit --allow-empty -m "Deploy to GitHub pages" 40 echo "Changes committed" 41 # and push, but send any output to /dev/null to hide anything sensitive 42 git push --force --quiet origin gh-pages > /dev/null 2>&1 43 echo "Changes pushed" 44 # go back to where we started and remove the gh-pages git repo we made and used 45 # for deployment 46 cd .. 47 rm -rf gh-pages-branch 48 49 echo "Finished Deployment!"