tools/semver_git_tag with --no-verify
This commit is contained in:
+50
-5
@@ -1,10 +1,50 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# CONSTANTS
|
||||||
|
|
||||||
|
NOVERIFY=false
|
||||||
|
|
||||||
|
# FUNCTIONS
|
||||||
|
|
||||||
function usage {
|
function usage {
|
||||||
echo 'usage: --major | -M | --minor | -m | --patch | -p'
|
echo 'usage: < --major | -M | --minor | -m | --patch | -p > [--no-verify]'
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parse_options {
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--major | -M)
|
||||||
|
shift 1
|
||||||
|
ret='major'
|
||||||
|
;;
|
||||||
|
--minor | -m)
|
||||||
|
shift 1
|
||||||
|
ret='minor'
|
||||||
|
;;
|
||||||
|
--patch | -p)
|
||||||
|
shift 1
|
||||||
|
ret='patch'
|
||||||
|
;;
|
||||||
|
--no-verify)
|
||||||
|
shift 1
|
||||||
|
NOVERIFY=true
|
||||||
|
;;
|
||||||
|
--help | -h)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown option: $1"
|
||||||
|
usage
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
shift 1 # Move to the next argument
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
function setCommand {
|
function setCommand {
|
||||||
#arg1 input, #arg2 return value
|
#arg1 input, #arg2 return value
|
||||||
declare -n ret=$2
|
declare -n ret=$2
|
||||||
@@ -31,6 +71,12 @@ function setCommand {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function extra_options {
|
||||||
|
extra=""
|
||||||
|
[[ $NOVERIFY == true ]] && extra="$extra --no-verify"
|
||||||
|
echo "$extra"
|
||||||
|
}
|
||||||
|
|
||||||
############# main
|
############# main
|
||||||
|
|
||||||
# check git covered
|
# check git covered
|
||||||
@@ -59,7 +105,7 @@ current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|||||||
push_needed=$(git rev-list --branches --not --remotes | wc -l)
|
push_needed=$(git rev-list --branches --not --remotes | wc -l)
|
||||||
if [[ $push_needed -ne 0 ]]; then
|
if [[ $push_needed -ne 0 ]]; then
|
||||||
echo 'git push needed'
|
echo 'git push needed'
|
||||||
git push --set-upstream origin "$current_branch" --no-verify
|
git push --set-upstream origin "$current_branch" $(extra_options)
|
||||||
echo 'git push done'
|
echo 'git push done'
|
||||||
echo '-------------'
|
echo '-------------'
|
||||||
fi
|
fi
|
||||||
@@ -99,9 +145,8 @@ if [[ $COMMAND == 'ask' ]]; then
|
|||||||
COMMAND="-$input"
|
COMMAND="-$input"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
setCommand $COMMAND COMMAND
|
parse_options $*
|
||||||
|
|
||||||
echo "before case"
|
|
||||||
case $COMMAND in
|
case $COMMAND in
|
||||||
"major")
|
"major")
|
||||||
let "MAJOR++"
|
let "MAJOR++"
|
||||||
@@ -146,5 +191,5 @@ git add ${GIT_ROOT_FOLDER}/.semver_git_tag
|
|||||||
echo "tagging as $TAG ..."
|
echo "tagging as $TAG ..."
|
||||||
git commit -am "tagged as ${TAG}"
|
git commit -am "tagged as ${TAG}"
|
||||||
git tag $TAG
|
git tag $TAG
|
||||||
git push origin "$current_branch" --tags --no-verify
|
git push origin "$current_branch" --tags $(extra_options)
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|||||||
Reference in New Issue
Block a user