Skip to content

Commit

Permalink
Merge pull request #16 from upfrontIO/trigger-semantic
Browse files Browse the repository at this point in the history
Trigger semantic
  • Loading branch information
mthpvg authored Sep 8, 2017
2 parents eb59dfb + b36ba6a commit 468c733
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
66 changes: 66 additions & 0 deletions bin/push-feat-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash
set -e

# require helper
currentDir=$(node -e "console.log(require('path').dirname(require('fs').realpathSync('$BASH_SOURCE')))")
source $currentDir/helper


version=$1
hasVersion=$(git tag -l "$version" | wc -l | tr -d '[:space:]')


# Help messages
if [ "x$1" = "x" ]; then
yellowLog "This script will create and push a branch with a feat commit."
yellowLog "Argument 1 (MUST) : <version> to create f.e. v10.0.0"
exit 1
fi


# Does the version already exists?
if [[ "$hasVersion" == "1" ]]; then
yellowLog "ERR: The version $version already exists."
exit 1
fi


# Does the branch to create already exist?
if [ $(git branch -a | grep "bump-$version") ]; then
yellowLog "ERR: Branch bump-$version already exists."
exit 1
fi


# Are there uncommited changes?
hasUncommitedChanges=$(git diff)
if [[ $hasUncommitedChanges ]]; then
yellowLog "ERR: You have uncommited changes."
exit 1
fi


yellowLog "Initialize the most recent master branch"
git fetch --all
git checkout master
git reset --hard HEAD
git pull --rebase origin master
git reset --hard origin/master


yellowLog "Create a new branch bump-$version"
git checkout -b "bump-$version"


yellowLog "Create an empty commit in the branch bump-$version"
git commit --allow-empty -m "feat: bump minor version to $version for release management"

yellowLog "Push the branch bump-$version"
git push origin "bump-$version"


yellowLog "Delete the local release branch bump-$version"
git checkout master
git branch -D "bump-$version"

yellowLog "push-feat-commit has been executed successfully"
4 changes: 4 additions & 0 deletions li-release
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ help () {
>&2 echo " helper commands:"
>&2 echo " upgrade-rancher-container: Upgrade the image of a rancher service"
>&2 echo " tag-publish-docker-image: Tag and publish docker image"
>&2 echo " push-feat-commit: Create and push a branch with a feat commit."
>&2 echo ""
exit 1
}
Expand All @@ -40,6 +41,9 @@ case "$cmd" in
tag-and-deploy-docker-image)
$currentDir/bin/tag-and-deploy-docker-image $*
;;
push-feat-commit)
$currentDir/bin/push-feat-commit $*
;;
*)
help
;;
Expand Down

0 comments on commit 468c733

Please sign in to comment.