Skip to content

Commit 6c8b2ab

Browse files
author
R. S. Doiel
committed
commiting to main
1 parent 8ffe27f commit 6c8b2ab

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

publish.bash

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
#
3+
4+
WORKING_BRANCH=$(git branch | grep -E "\* " | cut -d \ -f 2)
5+
if [ "$WORKING_BRANCH" = "gh-pages" ]; then
6+
git commit -am "publishing to gh-pages branch"
7+
git push origin gh-pages
8+
else
9+
echo "You're in $WORKING_BRANCH branch"
10+
echo "You need to pull in changes to the gh-pages branch to publish"
11+
read -p "process Y/n " YES_NO
12+
if [ "$YES_NO" = "Y" ] || [ "$YES_NO" = "y" ]; then
13+
echo "Committing and pushing to $WORKING_BRANCH"
14+
git commit -am "commiting to $WORKING_BRANCH"
15+
git push origin "$WORKING_BRANCH"
16+
echo "Changing branchs from $WORKING_BRANCH to gh-pages"
17+
git checkout gh-pages
18+
echo "Merging changes from origin gh-pages"
19+
git pull origin gh-pages
20+
git commit -am "merging origin gh-pages"
21+
echo "Pulling changes from $WORKING_BRANCH info gh-pages"
22+
git pull origin "$WORKING_BRANCH"
23+
echo "Merging changes from $WORKING_BRANCH"
24+
git commit -am "merging $WORKING_BRANCH with gh-pages"
25+
echo "Pushing changes up and publishing"
26+
git push origin gh-pages
27+
echo "Changing back to your working branch $WORKING_BRANCH"
28+
git checkout "$WORKING_BRANCH"
29+
fi
30+
fi

0 commit comments

Comments
 (0)