1#!/usr/bin/env bash
2
3# Parse arguments
4bump_type=${1:-minor}
5
6if [[ "$bump_type" != "minor" && "$bump_type" != "patch" ]]; then
7 echo "Usage: $0 [minor|patch]"
8 echo " minor (default): bumps the minor version (e.g., 0.1.0 -> 0.2.0)"
9 echo " patch: bumps the patch version (e.g., 0.1.0 -> 0.1.1)"
10 exit 1
11fi
12
13# Ensure we're in a clean state on an up-to-date `main` branch.
14if [[ -n $(git status --short --untracked-files=no) ]]; then
15 echo "can't bump versions with uncommitted changes"
16 exit 1
17fi
18if [[ $(git rev-parse --abbrev-ref HEAD) != "main" ]]; then
19 echo "this command must be run on main"
20 exit 1
21fi
22git pull -q --ff-only origin main
23
24
25# Parse the current version
26version=$(script/get-crate-version gpui)
27major=$(echo $version | cut -d. -f1)
28minor=$(echo $version | cut -d. -f2)
29patch=$(echo $version | cut -d. -f3)
30
31if [[ "$bump_type" == "minor" ]]; then
32 next_minor=$(expr $minor + 1)
33 next_version="${major}.${next_minor}.0"
34else
35 next_patch=$(expr $patch + 1)
36 next_version="${major}.${minor}.${next_patch}"
37fi
38
39branch_name="bump-gpui-to-v${next_version}"
40
41git checkout -b ${branch_name}
42
43script/lib/bump-version.sh gpui gpui-v "" $bump_type true
44
45git checkout -q main