#!/bin/bash set -e git pull --rebase if [[ -z $1 ]]; then echo "Usage: $0 {patch|minor|major}" exit 1 fi if [[ $1 =~ ^(patch|minor|major)$ ]]; then echo "Creating a new '$1' version" else echo "Invalid argument: $1" echo "Usage: $0 {patch|minor|major}" exit 1 fi if [[ -n $(git status --porcelain) ]]; then echo "Your working directory is not clean. Please commit or stash your changes before proceeding." exit 1 else echo "Your working directory is clean." fi # GNU sed takes the suffix as part of -i, BSD sed requires a separate argument sed_inplace() { if sed --version >/dev/null 2>&1; then sed -i "$@" else sed -i '' "$@" fi } echo "Bumping versions" which cargo-set-version || cargo install cargo-edit cargo set-version --bump "$1" NEWVER=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') which wasm-pack || cargo install wasm-pack wasm-pack build --target web --features wasm cd reconcile-js npm version "$NEWVER" --no-git-tag-version npm install cd ../reconcile-python sed_inplace "s/^version = \".*\"/version = \"$NEWVER\"/" Cargo.toml sed_inplace "s/^version = \".*\"/version = \"$NEWVER\"/" pyproject.toml cargo update --workspace uv lock cd ../examples/website npm install cd ../.. git add . git commit -m "Bump versions to $NEWVER" git push echo "Tagging $NEWVER" git tag -a $NEWVER -m "Release $NEWVER" git push origin $NEWVER echo "Done"