Add bump version shell (#1423)
<img width="517" height="663" alt="image" src="https://github.com/user-attachments/assets/49ae644e-9304-453a-940a-dde14075aedf" />
This commit is contained in:
parent
ab7af9c01d
commit
73362c59da
2 changed files with 122 additions and 5 deletions
|
|
@ -97,18 +97,26 @@ Use `samply record` command to start rust development, and do some operations in
|
|||
|
||||
When we are ready to release a new version, please follow the steps below:
|
||||
|
||||
### Use the script to bump the version(Recommended)
|
||||
|
||||
```bash
|
||||
./script/bump-version.sh x.y.z
|
||||
```
|
||||
|
||||
### Manually bump the version
|
||||
|
||||
1. Run `cargo set-version` to set the new version for all crates.
|
||||
|
||||
```bash
|
||||
cargo set-version 0.2.0
|
||||
cargo set-version x.y.z
|
||||
```
|
||||
|
||||
2. Git Commit the changes with message `chore: Release v0.2.0`.
|
||||
3. Create a new git tag with the version `v0.2.0` and push `main` branch and the tag to remote.
|
||||
2. Git Commit the changes with message `chore: Release vx.y.z`.
|
||||
3. Create a new git tag with the version `vx.y.z` and push `main` branch and the tag to remote.
|
||||
|
||||
```bash
|
||||
git tag v0.2.0
|
||||
git push origin main --tags
|
||||
git tag vx.y.z
|
||||
git push origin vx.y.z
|
||||
```
|
||||
|
||||
4. Then GitHub Actions will automatically publish the crates to crates.io and create a new release in GitHub.
|
||||
|
|
|
|||
109
script/bump-version.sh
Executable file
109
script/bump-version.sh
Executable file
|
|
@ -0,0 +1,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 ""
|
||||
Loading…
Reference in a new issue