#!/bin/bash

set -e

cargo binstall cargo-edit --locked
VERSION=$(cargo set-version --workspace --bump minor 2>&1 | awk '/Upgrading gled from/ {print $6}')
[ -n "$VERSION" ] || { echo "could not read the new version" >&2; exit 1; }

git commit Cargo.toml Cargo.lock -m "bump version"
git push

git tag $VERSION
git push --tag
