Skip to content

Commit 4023be9

Browse files
committed
chore: simplify the release tool
Tagging on the`master` or `patch` branch
1 parent 0dcd39d commit 4023be9

File tree

1 file changed

+8
-41
lines changed

1 file changed

+8
-41
lines changed

tools/release.sh

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -140,37 +140,6 @@ resume_config() {
140140
mv _config.yml.bak _config.yml
141141
}
142142

143-
# auto-generate a new version number to the file 'package.json'
144-
standard_version() {
145-
if $opt_pre; then
146-
standard-version --prerelease rc
147-
else
148-
standard-version
149-
fi
150-
}
151-
152-
# Prevent changelogs generated on master branch from having duplicate content
153-
# (the another bug of `standard-version`)
154-
standard_version_plus() {
155-
temp_branch="prod-mirror"
156-
temp_dir="$(mktemp -d)"
157-
158-
git checkout -b "$temp_branch" "$PROD_BRANCH"
159-
git merge --no-ff --no-edit "$STAGING_BRANCH"
160-
161-
standard_version
162-
163-
cp package.json CHANGELOG.md "$temp_dir"
164-
165-
git checkout "$STAGING_BRANCH"
166-
git reset --hard HEAD # undo the changes from $temp_branch
167-
mv "$temp_dir"/* . # rewrite the changelog
168-
169-
# clean up the temp stuff
170-
rm -rf "$temp_dir"
171-
git branch -D "$temp_branch"
172-
}
173-
174143
# build a gem package
175144
build_gem() {
176145
echo -e "Build the gem package for v$_version\n"
@@ -184,13 +153,13 @@ build_gem() {
184153
release() {
185154
_version="$1" # X.Y.Z
186155

187-
git checkout "$PROD_BRANCH"
188-
git merge --no-ff --no-edit "$working_branch"
189-
190-
# Create a new tag on production branch
156+
# Create a new tag on working branch
191157
echo -e "Create tag v$_version\n"
192158
git tag "v$_version"
193159

160+
git checkout "$PROD_BRANCH"
161+
git merge --no-ff --no-edit "$working_branch"
162+
194163
# merge from patch branch to the staging branch
195164
# NOTE: This may break due to merge conflicts, so it may need to be resolved manually.
196165
if [[ $working_branch == hotfix/* ]]; then
@@ -203,15 +172,13 @@ release() {
203172
main() {
204173
check
205174

206-
if [[ "$working_branch" == "$STAGING_BRANCH" ]]; then
207-
standard_version_plus
175+
# auto-generate a new version number to the file 'package.json'
176+
if $opt_pre; then
177+
standard-version --prerelease rc
208178
else
209-
standard_version
179+
standard-version
210180
fi
211181

212-
# Change heading of Patch version to level 2 (a bug from `standard-version`)
213-
sed -i "s/^### \[/## \[/g" CHANGELOG.md
214-
215182
_version="$(grep '"version":' package.json | sed 's/.*: "//;s/".*//')"
216183

217184
echo -e "Bump version number to $_version\n"

0 commit comments

Comments
 (0)