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