|
| 1 | +#!/bin/bash |
| 2 | +# generated with CMTools 0.0.1 7afe26c |
| 3 | +# |
| 4 | + |
| 5 | +# |
| 6 | +# Publish script for articlefetch for GitHub pages. It expect the gh-pages |
| 7 | +# branch to already exist. |
| 8 | +# |
| 9 | + |
| 10 | +WORKING_BRANCH=$(git branch | grep -E "\* " | cut -d \ -f 2) |
| 11 | +if [ "${WORKING_BRANCH}" = "gh-pages" ]; then |
| 12 | + git commit -am "publishing to gh-pages branch" |
| 13 | + git push origin gh-pages |
| 14 | +else |
| 15 | + echo "You're in ${WORKING_BRANCH} branch" |
| 16 | + echo "You need to pull in changes to the gh-pages branch to publish" |
| 17 | + # shellcheck disable=SC2162 |
| 18 | + read -p "process Y/n " YES_NO |
| 19 | + if [ "${YES_NO}" = "Y" ] || [ "${YES_NO}" = "y" ]; then |
| 20 | + echo "Committing and pushing to ${WORKING_BRANCH}" |
| 21 | + git commit -am "commiting to ${WORKING_BRANCH}" |
| 22 | + git push origin "${WORKING_BRANCH}" |
| 23 | + echo "Changing branchs from ${WORKING_BRANCH} to gh-pages" |
| 24 | + git checkout gh-pages |
| 25 | + echo "Merging changes from origin gh-pages" |
| 26 | + git pull origin gh-pages |
| 27 | + git commit -am "merging origin gh-pages" |
| 28 | + echo "Pulling changes from ${WORKING_BRANCH} info gh-pages" |
| 29 | + git pull origin "${WORKING_BRANCH}" |
| 30 | + echo "Merging changes from ${WORKING_BRANCH}" |
| 31 | + git commit -am "merging ${WORKING_BRANCH} with gh-pages" |
| 32 | + echo "Pushing changes up and publishing" |
| 33 | + git push origin gh-pages |
| 34 | + echo "Changing back to your working branch ${WORKING_BRANCH}" |
| 35 | + git checkout "${WORKING_BRANCH}" |
| 36 | + fi |
| 37 | +fi |
0 commit comments