Browse Source

Better mfpub

pull/1/head
Scott Lahteine 8 years ago
parent
commit
60a4ca1182
  1. 35
      buildroot/share/git/mfpub

35
buildroot/share/git/mfpub

@ -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,16 +46,21 @@ 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 # Allow working directly with the main fork
git push -f upstream echo -n "Pushing to origin/master... "
git push -f origin
else echo -n "Pushing to upstream/master... "
git push -f upstream
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"
@ -70,14 +73,14 @@ if [[ $BRANCH == "master" ]]; then
"$TOOL" "$URL" "$TOOL" "$URL"
fi fi
fi
fi fi
# Uncomment to compress the final html files # Uncomment to compress the final html files
# 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