#!/bin/bash set -euo pipefail . $(dirname $0)/functions.sh RELEASE_BRANCH=release-branch create_release_branch() { git fetch git checkout -B $RELEASE_BRANCH --no-track origin/main } update_version() { echo "Current version: $CURRENT_VERSION" read -p "New version: " VERSION sed -i "s/^version = .*/version = \"$VERSION\"/" Cargo.toml } update_changelog() { changie batch $VERSION changie merge } update_lock() { cargo build } push_changes() { git add Cargo.toml Cargo.lock CHANGELOG.md .changes git diff --staged if ! confirm "Ready to commit and push?" ; then exit 1 fi # Re-add in case we made changes git add Cargo.toml Cargo.lock CHANGELOG.md .changes git commit -m "Prepare $VERSION" cargo publish --dry-run git push -u origin $RELEASE_BRANCH glab mr create -f --yes --remove-source-branch } cd $(dirname "$0")/.. create_release_branch CURRENT_VERSION=$(get_version) update_version update_changelog update_lock push_changes