#!/usr/bin/env bash
set -e
cd "$(dirname $(dirname "$0"))" || exit

if [ -z "$1" ]; then
  echo "Usage: $0 [version]"
  exit 1
fi

if [[ ! -z "$(git status -s)" ]]; then
  echo "Uncomitted changes"
  exit 1
fi

poetry version $1
(cd static && npm version $1 --allow-same-version)
git add .
git commit -m "ci(version): $1"
git tag $1
