mirror of
https://github.com/beekeeper-studio/beekeeper-studio.git
synced 2026-03-13 10:12:54 +08:00
make release script
This commit is contained in:
@@ -14,10 +14,42 @@ list_recent_remote_tags() {
|
||||
done | sort -k2 -r | head -n 5
|
||||
}
|
||||
|
||||
# Function to get the next version in sequence
|
||||
guess_next_version() {
|
||||
# Get the most recent tag
|
||||
local latest_tag
|
||||
latest_tag=$(git ls-remote --tags origin | \
|
||||
grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?$' | \
|
||||
sort -V | tail -n 1)
|
||||
|
||||
# Strip 'v' from the tag
|
||||
latest_version="${latest_tag#v}"
|
||||
|
||||
if [[ "$latest_version" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(-(alpha|beta)\.([0-9]+))?$ ]]; then
|
||||
major="${BASH_REMATCH[1]}"
|
||||
minor="${BASH_REMATCH[2]}"
|
||||
patch="${BASH_REMATCH[3]}"
|
||||
channel="${BASH_REMATCH[5]:-}"
|
||||
channel_num="${BASH_REMATCH[6]:-}"
|
||||
|
||||
if [[ -n "$channel" ]]; then
|
||||
# Increment the channel number for pre-releases
|
||||
channel_num=$((channel_num + 1))
|
||||
echo "$major.$minor.$patch-$channel.$channel_num"
|
||||
else
|
||||
# Increment the patch version for stable releases
|
||||
patch=$((patch + 1))
|
||||
echo "$major.$minor.$patch"
|
||||
fi
|
||||
else
|
||||
echo "1.0.0" # Default to this if no valid tags exist
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to validate version format
|
||||
validate_version() {
|
||||
if [[ "$1" =~ ^([0-9]+\.[0-9]+\.[0-9]+)(-(alpha|beta)\.[0-9]+)?$ ]]; then
|
||||
echo "Valid version: $1"
|
||||
if [[ "$1" =~ ^v?([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)$ ]]; then
|
||||
echo "${BASH_REMATCH[1]}"
|
||||
else
|
||||
echo "Error: Invalid version format. Expected x.x.x or x.x.x-channel.x"
|
||||
exit 1
|
||||
@@ -27,15 +59,17 @@ validate_version() {
|
||||
# Step 1: List recent tags
|
||||
list_recent_remote_tags
|
||||
|
||||
# Step 2: Prompt user for new version
|
||||
# Step 2: Prompt user for new version with a default guess
|
||||
default_version=$(guess_next_version)
|
||||
echo ""
|
||||
read -p "Enter the new version (e.g., 5.0.0 or 5.0.0-beta.5): " VERSION
|
||||
read -p "Enter the new version (default: $default_version): " INPUT_VERSION
|
||||
VERSION="${INPUT_VERSION:-$default_version}"
|
||||
|
||||
# Validate the version
|
||||
validate_version "$VERSION"
|
||||
|
||||
# Step 3: Confirm with user
|
||||
# Step 3: Validate and clean the version
|
||||
VERSION=$(validate_version "$VERSION")
|
||||
NEW_TAG="v$VERSION"
|
||||
|
||||
# Confirm with the user
|
||||
echo ""
|
||||
echo "This will:"
|
||||
echo " - Update apps/studio/package.json to version: $VERSION"
|
||||
|
||||
Reference in New Issue
Block a user