Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tools/prepare_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

set -euo pipefail

VERSION="$(jq -r '.version' ./package.json)"
VERSION=${1-}
REQUIRED_TOOLS="jq git"

if test -z "$VERSION"; then
echo "Missing version parameter. Usage: $0 VERSION"
exit 1
fi

for tool in $REQUIRED_TOOLS; do
if ! hash "$tool" 2>/dev/null; then
echo "This script requires '$tool', but it is not installed."
Expand All @@ -17,6 +22,8 @@ if git rev-parse "v$VERSION" >/dev/null 2>&1; then
exit 1
fi

jq --arg new_version "$VERSION" '.version = ($new_version)' package.json > tmp.json && mv tmp.json package.json

git commit -a -m "prepare release v$VERSION"

git tag -a "v$VERSION" -m "$VERSION"