Tweak git helper scripts
This commit is contained in:
@ -2,7 +2,11 @@
|
||||
#
|
||||
# mfpub
|
||||
#
|
||||
# Use Jekyll to publish Marlin Documentation to the HTML site
|
||||
# Use Jekyll to generate Marlin Documentation, which is then
|
||||
# git-pushed to Github to publish it to the live site.
|
||||
# This publishes the current branch, and doesn't force
|
||||
# changes to be pushed to the 'master' branch. Be sure to push
|
||||
# any permanent changes to 'master'.
|
||||
#
|
||||
|
||||
MFINFO=$(mfinfo "$@") || exit
|
||||
@ -19,23 +23,22 @@ if [[ $ORG != "MarlinFirmware" || $REPO != "MarlinDocumentation" ]]; then
|
||||
fi
|
||||
|
||||
if [[ $BRANCH == "gh-pages" ]]; then
|
||||
echo "Can't build from 'gh-pages.' Only the Jekyll branches."
|
||||
echo "Can't build from 'gh-pages.' Only the Jekyll branches (based on 'master')."
|
||||
bundle exec jekyll serve --watch
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $BRANCH != "master" ]]; then
|
||||
echo "Don't forget to update and push 'master'!"
|
||||
# GOJF Card
|
||||
git stash
|
||||
fi
|
||||
|
||||
# Check out the named branch (or stay in current)
|
||||
git checkout $BRANCH
|
||||
|
||||
echo "Generating MarlinDocumentation..."
|
||||
|
||||
# GOJF Card
|
||||
git stash
|
||||
|
||||
TMPFOLDER=$( mktemp -d )
|
||||
COMMIT=$( git log --format="%H" -n 1 )
|
||||
|
||||
# Clean out changes and other junk in the branch
|
||||
@ -45,19 +48,28 @@ git clean -d -f
|
||||
# Push 'master' to the fork and make a proper PR...
|
||||
if [[ $BRANCH == "master" ]]; then
|
||||
|
||||
if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then firstpush; fi
|
||||
if [[ $$FORK == "MarlinFirmware" ]]; then
|
||||
|
||||
git push -f origin
|
||||
# Allow working directly with the main fork
|
||||
git push -f upstream
|
||||
|
||||
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"
|
||||
|
||||
if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then firstpush; fi
|
||||
|
||||
git push -f origin
|
||||
|
||||
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
|
||||
|
||||
fi
|
||||
@ -66,9 +78,12 @@ fi
|
||||
# mv ./_plugins/jekyll-press.rb-disabled ./_plugins/jekyll-press.rb
|
||||
# bundle install
|
||||
|
||||
# build the site statically and proof it
|
||||
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/:/"
|
||||
|
||||
# Sync the built site into a temporary folder
|
||||
TMPFOLDER=$( mktemp -d )
|
||||
rsync -av _site/ ${TMPFOLDER}/
|
||||
|
||||
# Clean out changes and other junk in the branch
|
||||
@ -84,6 +99,7 @@ git add --all
|
||||
git commit --message "Built from ${COMMIT}"
|
||||
git push upstream
|
||||
|
||||
# remove the temporary folder
|
||||
rm -rf ${TMPFOLDER}
|
||||
|
||||
# Go back to the branch we started from
|
||||
|
Reference in New Issue
Block a user