#!/usr/bin/env bash # Copyright Materialize, Inc. and contributors. All rights reserved. # # Use of this software is governed by the Business Source License # included in the LICENSE file at the root of this repository. # # As of the Change Date specified in that file, in accordance with # the Business Source License, use of this software will be governed # by the Apache License, Version 2.0. # # bump-version — sets the Materialize version in appropriate files. set -euo pipefail cd "$(dirname "$0")/.." . misc/shlib/shlib.bash if [[ $# -ne 1 && $# -ne 2 ]]; then die "usage: $0 VERSION [--no-commit]" fi commit=true if [[ $# -eq 2 ]]; then if [[ "$2" == "--no-commit" ]]; then commit=false else die "invalid flag: $2, only --no-commit is supported" fi fi if ! run git diff HEAD --compact-summary --exit-code; then die "cannot begin bump with uncommitted content" fi version=${1#v} sed -i.bak \ "s/^version = .*/version = \"$version\"/" \ src/{clusterd,environmentd,materialized,persist-client,testdrive,catalog-debug,balancerd,orchestratord}/Cargo.toml if ! [[ "$version" = *-dev* ]]; then sed -i.bak \ "s/^Licensed Work:.*/Licensed Work: Materialize Version v$version/" \ LICENSE else # Rename all upgrade tests that reference `current_source` to explicitly # reference the version of the last release. IFS='.' read -r -a parts <<< "$version" ((parts[1]--)) last_version="${parts[0]}.${parts[1]}.0" for file in test/legacy-upgrade/*current_source*; do if [[ "$file" = *example* ]]; then continue fi git mv "$file" "$(echo "$file" | sed "s/current_source/v$last_version/")" done fi rm -f src/{clusterd,environmentd,materialized,persist-client,testdrive,catalog-debug,balancerd,orchestratord}/Cargo.toml.bak LICENSE.bak cargo update --workspace bin/bazel gen bin/helm-chart-version-bump --bump-orchestratord-version "v$version" helm_docs_version=1.14.2 if ! helm-docs --help > /dev/null; then echo "helm-docs is currently not installed" echo "Install helm-docs $helm_docs_version from https://github.com/norwoodj/helm-docs/releases/tag/v$helm_docs_version" exit 1 fi if [ "$(helm-docs --version)" != "helm-docs version $helm_docs_version" ]; then echo "helm-docs is installed, but has wrong version: $(helm-docs --version)" echo "Install helm-docs $helm_docs_version from https://github.com/norwoodj/helm-docs/releases/tag/v$helm_docs_version" exit 1 fi helm-docs misc/helm-charts if $commit; then git commit -am "release: bump to version v$version" fi