build: add skip-versioning option for release tool

Allow change the `CHANGELOG.md`
This commit is contained in:
Cotes Chung 2022-10-25 21:13:59 +08:00
parent 339293d0d7
commit df8185f887
No known key found for this signature in database
GPG key ID: 0D9E54843167A808

View file

@ -14,7 +14,8 @@
set -eu set -eu
opt_pre=false # preview mode option opt_pre=false # preview mode option
opt_skip_ver=false # option for skip versioning
working_branch="$(git branch --show-current)" working_branch="$(git branch --show-current)"
@ -48,6 +49,7 @@ help() {
echo " bash ./tools/release.sh [options]" echo " bash ./tools/release.sh [options]"
echo echo
echo "Options:" echo "Options:"
echo " -k, --skip-versioning Skip the step of generating the version number."
echo " -p, --preview Enable preview mode, only package, and will not modify the branches" echo " -p, --preview Enable preview mode, only package, and will not modify the branches"
echo " -h, --help Print this information." echo " -h, --help Print this information."
} }
@ -170,13 +172,15 @@ release() {
} }
main() { main() {
check if [[ $opt_skip_ver = false ]]; then
check
# auto-generate a new version number to the file 'package.json' # auto-generate a new version number to the file 'package.json'
if $opt_pre; then if $opt_pre; then
standard-version --prerelease rc standard-version --prerelease rc
else else
standard-version standard-version
fi
fi fi
_version="$(grep '"version":' package.json | sed 's/.*: "//;s/".*//')" _version="$(grep '"version":' package.json | sed 's/.*: "//;s/".*//')"
@ -201,6 +205,10 @@ while (($#)); do
opt_pre=true opt_pre=true
shift shift
;; ;;
-k | --skip-versioning)
opt_skip_ver=true
shift
;;
-h | --help) -h | --help)
help help
exit 0 exit 0