Skip to content

Commit

Permalink
Adjusted push script
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Cuneo committed Jul 3, 2018
1 parent c5c682a commit 7b80f17
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "express-locator",
"version": "1.1.0",
"version": "1.2.0-alpha.0",
"description": "a service locator",
"repository": "git+https://rabidpug@github.com/rabidpug/express-locator.git",
"author": "Matt Cuneo",
Expand Down
48 changes: 41 additions & 7 deletions push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,34 @@ preid=$(echo $cur | grep -Eo '(alpha|beta|rc)')
assigned=''
changelog=$(<./CHANGELOG.md)

if [[ "$1$2" =~ (-n) ]];
if [ "$branch" = "beta" ];
then
next='next'
elif [ "$branch" = "next" ];
then
next='master'
elif [ ! "$branch" = "master" ];
then
next='beta';
fi

if [[ "$1$2$3" =~ (-n) ]] && [ ! "$branch" = "master" ];
then
if [ "$branch" = "master" ];
then
echo 'Cannot push to master without publishing'
exit 1;
fi
nogittag=" --no-git-tag-version";
else
nogittag="";
fi

if [[ "$1$2$3" =~ (-c) ]] && [ ! "$branch" = "master" ];
then
checkout="yes";
elif [[ "$1$2$3" =~ (-p) ]];
then
checkout="no";
else
checkout="";
fi

warn="Versioning error from $cur on $branch branch. Strict versioning protocols are in place:\n
1. Checkout master to any non- ( master | next | beta ) branch\n
2. develop feature - don't forget a changelog, tests, flowtypes\n
Expand All @@ -32,7 +48,8 @@ warn="Versioning error from $cur on $branch branch. Strict versioning protocols
11. merge to ( master ) branch\n
12. assign release version > yarn push\n
hint: you can increment the ( alpha | beta | rc ) prerelease version by calling yarn push\n
hint: you can inrement/assign the version without publishing by passing -n | --no-publish\n";
hint: you can inrement/assign the version without publishing by passing -n | --no-publish\n
hint: you can immediately checkout to the next branch by passing -c, or skip the prompt by passing -p\n";

function prompt
{
Expand Down Expand Up @@ -132,4 +149,21 @@ else
else
echo "pushing to $branch without publishing" && git push origin $branch;
fi;
if [ ! "$checkout" = "no" ];
then
if [ ! "$checkout" = "yes" ];
then
checkout=$(prompt "Checkout to $next?: " yes no);
fi
if [ "$checkout" = "yes" ];
then
branchExists=$(git branch | grep -Eo "$next");
if [ -z $branchExists ];
then
git checkout -b $next;
else
git checkout $next;
fi;
fi;
fi;
fi

0 comments on commit 7b80f17

Please sign in to comment.