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

This commit is contained in:
Max Brunsfeld 2022-10-26 11:29:47 -07:00
parent 0f1b0a4a78
commit 6a010f58be
3 changed files with 23 additions and 7 deletions

View file

@ -1,3 +1,18 @@
#!/bin/bash #!/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 $@

View file

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

View file

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