tools/semver_git_tag with --no-verify
This commit is contained in:
+50
-5
@@ -1,10 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
# CONSTANTS
|
||||
|
||||
NOVERIFY=false
|
||||
|
||||
# FUNCTIONS
|
||||
|
||||
function usage {
|
||||
echo 'usage: --major | -M | --minor | -m | --patch | -p'
|
||||
echo 'usage: < --major | -M | --minor | -m | --patch | -p > [--no-verify]'
|
||||
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 {
|
||||
#arg1 input, #arg2 return value
|
||||
declare -n ret=$2
|
||||
@@ -31,6 +71,12 @@ function setCommand {
|
||||
esac
|
||||
}
|
||||
|
||||
function extra_options {
|
||||
extra=""
|
||||
[[ $NOVERIFY == true ]] && extra="$extra --no-verify"
|
||||
echo "$extra"
|
||||
}
|
||||
|
||||
############# main
|
||||
|
||||
# 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)
|
||||
if [[ $push_needed -ne 0 ]]; then
|
||||
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 '-------------'
|
||||
fi
|
||||
@@ -99,9 +145,8 @@ if [[ $COMMAND == 'ask' ]]; then
|
||||
COMMAND="-$input"
|
||||
fi
|
||||
|
||||
setCommand $COMMAND COMMAND
|
||||
parse_options $*
|
||||
|
||||
echo "before case"
|
||||
case $COMMAND in
|
||||
"major")
|
||||
let "MAJOR++"
|
||||
@@ -146,5 +191,5 @@ git add ${GIT_ROOT_FOLDER}/.semver_git_tag
|
||||
echo "tagging as $TAG ..."
|
||||
git commit -am "tagged as ${TAG}"
|
||||
git tag $TAG
|
||||
git push origin "$current_branch" --tags --no-verify
|
||||
git push origin "$current_branch" --tags $(extra_options)
|
||||
echo "done"
|
||||
|
||||
Reference in New Issue
Block a user