123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- #!/usr/bin/env bash
-
-
-
-
-
-
-
-
-
-
- [[ $# < 2 ]] || { echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1; }
-
- MFINFO=$(mfinfo "$@") || exit 1
- IFS=' ' read -a INFO <<< "$MFINFO"
- ORG=${INFO[0]}
- FORK=${INFO[1]}
- REPO=${INFO[2]}
- TARG=${INFO[3]}
- BRANCH=${INFO[4]}
-
- if [[ $ORG != "MarlinFirmware" || $REPO != "MarlinDocumentation" ]]; then
- echo "Wrong repository."
- exit
- fi
-
-
- git checkout $BRANCH
-
- if [[ $BRANCH == "gh-pages" ]]; then
- echo "Can't build from 'gh-pages.' Only the Jekyll branches (based on 'master')."
- exit
- fi
-
- echo "Stashing any changes to files..."
- echo "Don't forget to update and push 'master'!"
-
- git stash
-
- COMMIT=$( git log --format="%H" -n 1 )
-
-
- git clean -d -f
-
-
- if [[ $BRANCH == "master" ]]; then
-
-
- echo
- echo -n "Pushing to origin/master... "
- git push -f origin
-
- echo
- echo -n "Pushing to upstream/master... "
- git push -f upstream
-
- else
-
- if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then
- firstpush
- else
- echo
- echo -n "Pushing to origin/$BRANCH... "
- git push -f origin
- fi
-
- TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }')
- URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
-
- if [ -z "$TOOL" ]; then
- echo "Can't find a tool to open the URL:"
- echo $URL
- else
- echo "Opening a New PR Form..."
- "$TOOL" "$URL"
- fi
-
- fi
-
-
-
-
-
- echo
- echo "Generating MarlinDocumentation..."
-
-
- bundle exec jekyll build --profile --trace --no-watch
- bundle exec htmlproofer ./_site --only-4xx --allow-hash-href --check-favicon --check-html --url-swap ".*marlinfw.org/:/"
-
-
- TMPFOLDER=$( mktemp -d )
- rsync -av _site/ ${TMPFOLDER}/
-
-
- git reset --hard
- git clean -d -f
-
-
- git checkout gh-pages
- rsync -av ${TMPFOLDER}/ ./
-
-
- git add --all
- git commit --message "Built from ${COMMIT}"
- git push upstream
-
-
- rm -rf ${TMPFOLDER}
-
-
- git checkout $BRANCH
-
- if [[ $BRANCH != "master" ]]; then
- git stash pop
- fi
|