forked from longbridge/gpui-component
-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathbump-version.sh
More file actions
executable file
·109 lines (95 loc) · 3.1 KB
/
Copy pathbump-version.sh
File metadata and controls
executable file
·109 lines (95 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
BOLD='\033[1m'
RESET='\033[0m'
# Check if version argument is provided
new_version=$1
if [ -z "$new_version" ]
then
echo -e "${RED}${BOLD}Error:${RESET} Version argument is required"
echo -e "${YELLOW}USAGE:${RESET} ./bump.sh [VERSION]"
exit 1
fi
# Logging functions
function log_header() {
local message=$1
echo ""
echo -e "${BOLD}${BLUE}╔════════════════════════════════════════════════════════╗${RESET}"
echo -e "${BOLD}${BLUE}║${RESET} ${CYAN}${BOLD}$message${RESET}"
echo -e "${BOLD}${BLUE}╚════════════════════════════════════════════════════════╝${RESET}"
echo ""
}
function log_step() {
local step=$1
local message=$2
echo -e "${MAGENTA}${BOLD}[$step]${RESET} ${message}"
}
function log_success() {
local message=$1
echo -e "${GREEN}${BOLD}✓${RESET} ${message}"
}
function log_info() {
local message=$1
echo -e "${CYAN}ℹ${RESET} ${message}"
}
function log_error() {
local message=$1
echo -e "${RED}${BOLD}✗${RESET} ${message}"
}
# Start release process
log_header "Starting Release Process for v$new_version"
# Step 1: Update crates version
log_step "1/4" "Updating crates to version ${BOLD}v$new_version${RESET}"
if cargo set-version "$new_version"; then
log_success "Crates version updated successfully"
else
log_error "Failed to update crates version"
exit 1
fi
echo ""
# Step 2: Stage changes
log_step "2/4" "Staging modified files"
if git add -u .; then
log_success "Files staged successfully"
else
log_error "Failed to stage files"
exit 1
fi
echo ""
# Step 3: Create commit and tag
log_step "3/4" "Creating commit and tag"
if git commit -m "Bump v$new_version"; then
log_success "Commit created: ${BOLD}Bump v$new_version${RESET}"
else
log_error "Failed to create commit"
exit 1
fi
if git tag "v$new_version"; then
log_success "Tag created: ${BOLD}v$new_version${RESET}"
else
log_error "Failed to create tag"
exit 1
fi
echo ""
# Step 4: Push to remote
log_step "4/4" "Pushing tag to remote"
log_info "Pushing ${BOLD}v$new_version${RESET} to origin..."
if git push origin "v$new_version"; then
log_success "Tag pushed to remote successfully"
else
log_error "Failed to push tag to remote"
exit 1
fi
echo ""
# Success message
echo -e "${GREEN}${BOLD}╔════════════════════════════════════════════════════════╗${RESET}"
echo -e "${GREEN}${BOLD}║${RESET} ${BOLD}🚀 Release v$new_version standby!${RESET}"
echo -e "${GREEN}${BOLD}║${RESET} ${GREEN}Let's ship it!${RESET}"
echo -e "${GREEN}${BOLD}╚════════════════════════════════════════════════════════╝${RESET}"
echo ""