diff --git a/script/bump-app-version b/script/bump-app-version new file mode 100755 index 0000000000..88433b6c70 --- /dev/null +++ b/script/bump-app-version @@ -0,0 +1,3 @@ +#!/bin/bash + +exec script/lib/bump-version.sh zed v $@ diff --git a/script/bump-collab-version b/script/bump-collab-version new file mode 100755 index 0000000000..35f333f76a --- /dev/null +++ b/script/bump-collab-version @@ -0,0 +1,3 @@ +#!/bin/bash + +exec script/lib/bump-version.sh collab collab-v $@ diff --git a/script/lib/bump-version.sh b/script/lib/bump-version.sh new file mode 100755 index 0000000000..205fc168ef --- /dev/null +++ b/script/lib/bump-version.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -eu + +if [[ $# < 3 ]]; then + echo "Missing version increment (major, minor, or patch)" >&2 + exit 1 +fi + +package=$1 +tag_prefix=$2 +version_increment=$3 + +if [[ -n $(git status --short --untracked-files=no) ]]; then + echo "Can't push a new version with uncommitted changes" + exit 1 +fi + +which cargo-set-version > /dev/null || cargo install cargo-edit +cargo set-version --package $package --bump $version_increment +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} + +git commit --quiet --all --message "${package} ${new_version}" +git tag ${tag_name} + +cat <