Skip to content

Commit f9e3276

Browse files
authored
add script update version all branch (#1004)
1 parent d9279ef commit f9e3276

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"version:minor": "lerna version patch --no-push --exact --force-publish",
2929
"version:patch": "echo \"No patch versions: See root README.md\"",
3030
"prepare": "husky",
31-
"tsc": "echo 'You are trying to run \"tsc\" in the workspace root. Run it from an individual package instead.' && exit 1"
31+
"tsc": "echo 'You are trying to run \"tsc\" in the workspace root. Run it from an individual package instead.' && exit 1",
32+
"updateVersionsAllBranch": "chmod +x scripts/update-versions-all-branch.sh && ./scripts/update-versions-all-branch.sh"
3233
},
3334
"workspaces": [
3435
"example",

scripts/update-versions-all-branch.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
# Array of branch names - you can modify this array as needed
4+
branches=("50" "master" "52-beta")
5+
6+
GREEN='\033[0;32m'
7+
BLUE='\033[0;34m'
8+
YELLOW='\033[1;33m'
9+
RED='\033[0;31m'
10+
NC='\033[0m' # No Color
11+
12+
handle_error() {
13+
echo -e "${RED}❌ Error: $1${NC}"
14+
exit 1
15+
}
16+
17+
for branch in "${branches[@]}"; do
18+
echo -e "${BLUE}🔄 Processing branch: $branch${NC}"
19+
20+
git checkout "$branch" || handle_error "Failed to checkout branch $branch"
21+
22+
# Pull latest changes
23+
echo -e "${YELLOW}📥 Pulling latest changes...${NC}"
24+
git pull || handle_error "Failed to pull latest changes on branch $branch"
25+
26+
# Clean install dependencies
27+
echo -e "${YELLOW}📦 Installing dependencies...${NC}"
28+
rm -rf node_modules
29+
yarn install || handle_error "Failed to install dependencies on branch $branch"
30+
31+
# Increase minor version
32+
echo -e "${YELLOW}⬆️ Increasing minor version...${NC}"
33+
yarn version:minor -- -y || handle_error "Failed to increase version on branch $branch"
34+
35+
# Push code changes
36+
echo -e "${YELLOW}📤 Pushing code changes...${NC}"
37+
git push || handle_error "Failed to push code changes on branch $branch"
38+
39+
# Push tags
40+
echo -e "${YELLOW}🏷️ Pushing tags...${NC}"
41+
git push --tags || handle_error "Failed to push tags on branch $branch"
42+
43+
echo -e "${GREEN}✅ Completed processing branch: $branch${NC}"
44+
echo -e "${BLUE}----------------------------------------${NC}"
45+
done
46+
47+
echo -e "${GREEN}🎉 All branches have been processed successfully!${NC}"

0 commit comments

Comments
 (0)