Account for current release channel in bump-app-version script

Max Brunsfeld created

Change summary

script/bump-app-version    | 17 ++++++++++++++++-
script/bump-collab-version |  2 +-
script/lib/bump-version.sh | 11 ++++++-----
3 files changed, 23 insertions(+), 7 deletions(-)

Detailed changes

script/bump-app-version 🔗

@@ -1,3 +1,18 @@
 #!/bin/bash
 
-exec script/lib/bump-version.sh zed v $@
+channel=$(cat crates/zed/RELEASE_CHANNEL)
+
+tag_suffix=""
+case $channel; in
+  stable)
+    ;;
+  preview)
+    tag_suffix="-pre"
+    ;;
+  *)
+    echo "do this on a release branch where RELEASE_CHANNEL is either 'preview' or 'stable'" >&2
+    exit 1
+    ;;
+esac
+
+exec script/lib/bump-version.sh zed v $tag_suffix $@

script/bump-collab-version 🔗

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-exec script/lib/bump-version.sh collab collab-v $@
+exec script/lib/bump-version.sh collab collab-v '' $@

script/lib/bump-version.sh 🔗

@@ -2,14 +2,15 @@
 
 set -eu
 
-if [[ $# < 3 ]]; then
+if [[ $# < 4 ]]; then
   echo "Missing version increment (major, minor, or patch)" >&2
   exit 1
 fi
 
 package=$1
 tag_prefix=$2
-version_increment=$3
+tag_suffix=$3
+version_increment=$4
 
 if [[ -n $(git status --short --untracked-files=no) ]]; then
   echo "Can't push a new version with uncommitted changes"
@@ -23,17 +24,17 @@ cargo check --quiet
 new_version=$(cargo metadata --no-deps --format-version=1 | jq --raw-output ".packages[] | select(.name == \"${package}\") | .version")
 branch_name=$(git rev-parse --abbrev-ref HEAD)
 old_sha=$(git rev-parse HEAD)
-tag_name=${tag_prefix}${new_version}
+tag_name=${tag_prefix}${new_version}${tag_suffix}
 
 git commit --quiet --all --message "${package} ${new_version}"
 git tag ${tag_name}
 
 cat <<MESSAGE
-Committed and tagged ${package} version ${new_version}
+Locally committed and tagged ${package} version ${new_version}
 
 To push this:
     git push origin ${tag_name} ${branch_name}
 
 To undo this:
-    git tag -d ${tag_name} && git reset --hard $old_sha
+    git tag -d ${tag_name} && git reset --hard ${old_sha}
 MESSAGE