-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# 检查是否提供了版本号 | ||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 <new-version>" | ||
exit 1 | ||
fi | ||
|
||
# 新版本号 | ||
NEW_VERSION=$1 | ||
|
||
# 更新根目录下的 package.json | ||
sed -i '' "s/\"version\": \".*\"/\"version\": \"$NEW_VERSION\"/" package.json | ||
|
||
# 更新 apps 目录下所有子包的 package.json | ||
for d in apps/*; do | ||
if [ -d "$d" ] && [ -f "$d/package.json" ]; then | ||
sed -i '' "s/\"version\": \".*\"/\"version\": \"$NEW_VERSION\"/" "$d/package.json" | ||
fi | ||
done | ||
|
||
echo "All packages updated to version $NEW_VERSION" | ||
|
||
# 创建 Git 提交(可选) | ||
git add . | ||
git commit -m "Release version $NEW_VERSION" | ||
|
||
# 创建 Git 标签 | ||
git tag "v$NEW_VERSION" | ||
|
||
# 推送更改和标签到远程仓库 | ||
git push && git push origin "v$NEW_VERSION" | ||
|
||
echo "Git tag v$NEW_VERSION has been created and pushed" |