Merge pull request #6681 from thinkyhead/bf_better_mfpub

Better mfpub
2.0.x
Scott Lahteine 8 years ago committed by GitHub
commit 2819228d4f

@ -22,23 +22,21 @@ if [[ $ORG != "MarlinFirmware" || $REPO != "MarlinDocumentation" ]]; then
exit exit
fi fi
# Check out the named branch (or stay in current)
git checkout $BRANCH
if [[ $BRANCH == "gh-pages" ]]; then if [[ $BRANCH == "gh-pages" ]]; then
echo "Can't build from 'gh-pages.' Only the Jekyll branches (based on 'master')." echo "Can't build from 'gh-pages.' Only the Jekyll branches (based on 'master')."
bundle exec jekyll serve --watch
exit exit
fi fi
if [[ $BRANCH != "master" ]]; then if [[ $BRANCH != "master" ]]; then
echo "Stashing any changes to files..."
echo "Don't forget to update and push 'master'!" echo "Don't forget to update and push 'master'!"
# GOJF Card # GOJF Card
git stash git stash
fi fi
# Check out the named branch (or stay in current)
git checkout $BRANCH
echo "Generating MarlinDocumentation..."
COMMIT=$( git log --format="%H" -n 1 ) COMMIT=$( git log --format="%H" -n 1 )
# Clean out changes and other junk in the branch # Clean out changes and other junk in the branch
@ -48,28 +46,31 @@ git clean -d -f
# Push 'master' to the fork and make a proper PR... # Push 'master' to the fork and make a proper PR...
if [[ $BRANCH == "master" ]]; then if [[ $BRANCH == "master" ]]; then
if [[ $FORK == "MarlinFirmware" ]]; then # Allow working directly with the main fork
echo -n "Pushing to origin/master... "
git push -f origin
# Allow working directly with the main fork echo -n "Pushing to upstream/master... "
git push -f upstream git push -f upstream
else
if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then firstpush; fi else
if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then
firstpush
else
echo -n "Pushing to origin/$BRANCH... "
git push -f origin git push -f origin
fi
TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }') TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }')
URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=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
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 fi
@ -78,6 +79,8 @@ fi
# mv ./_plugins/jekyll-press.rb-disabled ./_plugins/jekyll-press.rb # mv ./_plugins/jekyll-press.rb-disabled ./_plugins/jekyll-press.rb
# bundle install # bundle install
echo "Generating MarlinDocumentation..."
# build the site statically and proof it # build the site statically and proof it
bundle exec jekyll build --profile --trace --no-watch 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/:/" bundle exec htmlproofer ./_site --only-4xx --allow-hash-href --check-favicon --check-html --url-swap ".*marlinfw.org/:/"
@ -90,7 +93,7 @@ rsync -av _site/ ${TMPFOLDER}/
git reset --hard git reset --hard
git clean -d -f git clean -d -f
# Sync built-site with gh-pages # Copy built-site into the gh-pages branch
git checkout gh-pages git checkout gh-pages
rsync -av ${TMPFOLDER}/ ./ rsync -av ${TMPFOLDER}/ ./
@ -104,3 +107,7 @@ rm -rf ${TMPFOLDER}
# Go back to the branch we started from # Go back to the branch we started from
git checkout $BRANCH git checkout $BRANCH
if [[ $BRANCH != "master" ]]; then
git stash pop
fi

Loading…
Cancel
Save