Skip to content

Commit

Permalink
chore: add release.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
cooderl committed Mar 3, 2024
1 parent c3d3138 commit e435cc4
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions release.sh
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"

0 comments on commit e435cc4

Please sign in to comment.