#!/usr/bin/env bash ## cut a new 5.x release for EMQX (opensource or enterprise). set -euo pipefail if [ "${DEBUG:-}" = 1 ]; then set -x fi # ensure dir cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." usage() { cat </dev/null | xargs -0)" for c in $CHECKS; do logmsg "Executing $c" $c done fi generate_changelog () { local from_tag="${PREV_TAG:-}" if [[ -z $from_tag ]]; then if [ $PROFILE == "emqx" ]; then from_tag="$(git describe --tags --abbrev=0 --match 'v*')" else from_tag="$(git describe --tags --abbrev=0 --match 'e*')" fi fi local output_dir="changes" ./scripts/format-changelog.sh $PROFILE "${from_tag}" "${TAG}" $output_dir git add $output_dir [ -n "$(git status -s)" ] && git commit -m "chore: Generate changelog for ${TAG}" } if [ "$DRYRUN" = 'yes' ]; then logmsg "Release tag is ready to be created with command: git tag $TAG" else case "$TAG" in *rc*) true ;; *alpha*) true ;; *beta*) true ;; e5.0.0*) # the first release has no change log true ;; *) generate_changelog ;; esac git tag "$TAG" logmsg "$TAG is created OK." fi