#!/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 ./scripts/rel/format-changelog.sh -b "${from_tag}" -l 'en' -v "$TAG" > "changes/${TAG}.en.md" ./scripts/rel/format-changelog.sh -b "${from_tag}" -l 'zh' -v "$TAG" > "changes/${TAG}.zh.md" git add changes/"${TAG}".*.md [ -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