build: fix the `preview` mode for release tool

This commit is contained in:
Cotes Chung 2022-06-09 15:01:27 +08:00
parent fd0f983bbe
commit 7f18cdc1fd
No known key found for this signature in database
GPG Key ID: 0D9E54843167A808
1 changed files with 7 additions and 11 deletions

View File

@ -184,11 +184,6 @@ build_gem() {
release() { release() {
_version="$1" # X.Y.Z _version="$1" # X.Y.Z
if $opt_pre; then
$opt_pre
exit 0
fi
git checkout "$PROD_BRANCH" git checkout "$PROD_BRANCH"
git merge --no-ff --no-edit "$working_branch" git merge --no-ff --no-edit "$working_branch"
@ -196,8 +191,6 @@ release() {
echo -e "Create tag v$_version\n" echo -e "Create tag v$_version\n"
git tag "v$_version" git tag "v$_version"
build_gem
# merge from patch branch to the staging branch # merge from patch branch to the staging branch
# NOTE: This may break due to merge conflicts, so it may need to be resolved manually. # NOTE: This may break due to merge conflicts, so it may need to be resolved manually.
if [[ $working_branch == hotfix/* ]]; then if [[ $working_branch == hotfix/* ]]; then
@ -224,11 +217,14 @@ main() {
echo -e "Bump version number to $_version\n" echo -e "Bump version number to $_version\n"
bump "$_version" bump "$_version"
release "$_version" build_gem
if [[ $opt_pre = true ]]; then
# Undo all changes on Git # Undo all changes on Git
$opt_pre && git reset --hard && git clean -fd git reset --hard && git clean -fd
else
release "$_version"
fi
} }
while (($#)); do while (($#)); do