#!/usr/bin/env bash stty -onlcr # don't translate newline to carriage return-newline, as these break patch tool set -e OPA_DIR=/go/src/github.com/open-policy-agent/opa usage() { echo "gen-release-patch.sh --source-url=" echo " --version=" } for i in "$@"; do case $i in --source-url=*) SOURCE_URL="${i#*=}" shift ;; --version=*) VERSION="${i#*=}" shift ;; *) usage exit 1 ;; esac done if [ -z "$SOURCE_URL" ]; then usage exit 1 elif [ -z "$VERSION" ]; then usage exit 1 fi git clone $SOURCE_URL $OPA_DIR cd $OPA_DIR if [ -z "$LAST_VERSION" ]; then LAST_VERSION=$(git describe --abbrev=0 --tags) fi update_version() { ./build/update-version.sh "$VERSION" } update_changelog() { if $(grep -q '## Unreleased' CHANGELOG.md) ; then cat >_CHANGELOG.md <_CHANGELOG.md <