Parcourir la source

Merge pull request #9682 from ieQu1/changelog-gen

ci: Change how the changelog is created
ieQu1 il y a 3 ans
Parent
commit
32922a6830

+ 1 - 1
.github/PULL_REQUEST_TEMPLATE/v5.md

@@ -5,7 +5,7 @@ Please convert it to a draft if any of the following conditions are not met. Rev
 
 
 - [ ] Added tests for the changes
 - [ ] Added tests for the changes
 - [ ] Changed lines covered in coverage report
 - [ ] Changed lines covered in coverage report
-- [ ] Change log has been added to `changes/` dir
+- [ ] Change log has been added to `changes/<version>/(feat|fix)-<PR-id>.en.md` and `.zh.md` files
 - [ ] For internal contributor: there is a jira ticket to track this change
 - [ ] For internal contributor: there is a jira ticket to track this change
 - [ ] If there should be document changes, a PR to emqx-docs.git is sent, or a jira ticket is created to follow up
 - [ ] If there should be document changes, a PR to emqx-docs.git is sent, or a jira ticket is created to follow up
 - [ ] Schema changes are backward compatible
 - [ ] Schema changes are backward compatible

+ 0 - 20
changes/v5.0.14-en.md

@@ -1,20 +0,0 @@
-# v5.0.14
-
-## Enhancements
-
-- Make possible to configure `host:port` from environment variables without quotes [#9614](https://github.com/emqx/emqx/pull/9614).
-  Prior to this change, when overriding a `host:port` config value from environment variable, one has to quote it as:
-  `env EMQX_BRIDGES__MQTT__XYZ__SERVER='"localhost:1883"'`.
-  Now it's possible to set it without quote as `env EMQX_BRIDGES__MQTT__XYZ__SERVER='localhost:1883'`.
-
-- Obfuscated sensitive data in the response when querying `bridges` information by API [#9593](https://github.com/emqx/emqx/pull/9593/).
-
-- Made rule engine behavior more consistent with bridge behavior regarding metrics: if a rule engine is disabled, its metrics are now reset []().
-
-## Bug Fixes
-
-- Fix an issue where testing the GCP PubSub could leak memory, and an issue where its JWT token would fail to refresh a second time. [#9641](https://github.com/emqx/emqx/pull/9641)
-
-- Fix the problem of data loss and bad match when the MySQL driver is disconnected [#9638](https://github.com/emqx/emqx/pull/9638).
-
-- Fixed an issue where changing the storage type of the built-in database retainer would not take effect without restarting the node [#9676](https://github.com/emqx/emqx/pull/9676).

+ 0 - 20
changes/v5.0.14-zh.md

@@ -1,20 +0,0 @@
-# v5.0.14
-
-## 增强
-
-- 允许环境变量重载 `host:port` 值时不使用引号 [#9614](https://github.com/emqx/emqx/pull/9614)。
-  在此修复前,环境变量中使用 `host:port` 这种配置时,用户必须使用引号,例如:
-  `env EMQX_BRIDGES__MQTT__XYZ__SERVER='"localhost:1883"'`。
-  此修复后,可以不使用引号,例如 `env EMQX_BRIDGES__MQTT__XYZ__SERVER='localhost:1883'`。
-
-- 通过 API 查询 `bridges` 信息时将混淆响应中的敏感数据 [#9593](https://github.com/emqx/emqx/pull/9593/)。
-
-- 使得规则引擎的行为与桥梁的指标行为更加一致:如果一个规则引擎被禁用,其指标现在会被重置 []()。
-
-## 修复
-
-- 修复了测试GCP PubSub可能泄露内存的问题,以及其JWT令牌第二次刷新失败的问题。 [#9640](https://github.com/emqx/emqx/pull/9640)
-
-- 修复 MySQL 驱动断开连接时出现的数据丢失和匹配错误的问题 [#9638](https://github.com/emqx/emqx/pull/9638)。
-
-- 修复了如果不重新启动节点,改变保留消息的存储类型将不会生效的问题 [#9676](https://github.com/emqx/emqx/pull/9676)。

+ 1 - 0
changes/v5.0.14/feat-9593.en.md

@@ -0,0 +1 @@
+Obfuscated sensitive data in the response when querying `bridges` information by API.

+ 1 - 0
changes/v5.0.14/feat-9593.zh.md

@@ -0,0 +1 @@
+通过 API 查询 `bridges` 信息时将混淆响应中的敏感数据。

+ 4 - 0
changes/v5.0.14/feat-9614.en.md

@@ -0,0 +1,4 @@
+Make possible to configure `host:port` from environment variables without quotes.
+Prior to this change, when overriding a `host:port` config value from environment variable, one has to quote it as:
+`env EMQX_BRIDGES__MQTT__XYZ__SERVER='"localhost:1883"'`.
+Now it's possible to set it without quote as `env EMQX_BRIDGES__MQTT__XYZ__SERVER='localhost:1883'`.

+ 4 - 0
changes/v5.0.14/feat-9614.zh.md

@@ -0,0 +1,4 @@
+允许环境变量重载 `host:port` 值时不使用引号。
+在此修复前,环境变量中使用 `host:port` 这种配置时,用户必须使用引号,例如:
+`env EMQX_BRIDGES__MQTT__XYZ__SERVER='"localhost:1883"'`。
+此修复后,可以不使用引号,例如 `env EMQX_BRIDGES__MQTT__XYZ__SERVER='localhost:1883'`。

+ 1 - 0
changes/v5.0.14/feat-9674.en.md

@@ -0,0 +1 @@
+Made rule engine behavior more consistent with bridge behavior regarding metrics: if a rule engine is disabled, its metrics are now reset

+ 1 - 0
changes/v5.0.14/feat-9674.zh.md

@@ -0,0 +1 @@
+使得规则引擎的行为与桥梁的指标行为更加一致:如果一个规则引擎被禁用,其指标现在会被重置。

+ 1 - 0
changes/v5.0.14/fix-9638.en.md

@@ -0,0 +1 @@
+Fix the problem of data loss and bad match when the MySQL driver is disconnected.

+ 1 - 0
changes/v5.0.14/fix-9638.zh.md

@@ -0,0 +1 @@
+修复 MySQL 驱动断开连接时出现的数据丢失和匹配错误的问题。

+ 1 - 0
changes/v5.0.14/fix-9641.en.md

@@ -0,0 +1 @@
+Fix an issue where testing the GCP PubSub could leak memory, and an issue where its JWT token would fail to refresh a second time.

+ 1 - 0
changes/v5.0.14/fix-9641.zh.md

@@ -0,0 +1 @@
+修复了测试GCP PubSub可能泄露内存的问题,以及其JWT令牌第二次刷新失败的问题。

+ 62 - 0
scripts/format-changelog.sh

@@ -0,0 +1,62 @@
+#!/bin/bash
+set -euo pipefail
+shopt -s nullglob
+export LANG=C.UTF-8
+
+[ "$#" -ne 2 ] && {
+    echo "Usage $0 <EMQX version> <en|zh>" 1>&2;
+    exit 1
+}
+
+version="${1}"
+language="${2}"
+
+changes_dir="$(git rev-parse --show-toplevel)/changes/${version}"
+
+item() {
+    local filename pr indent
+    filename="${1}"
+    pr="$(echo "${filename}" | sed -E 's/.*-([0-9]+)\.(en|zh)\.md$/\1/')"
+    indent="- [#${pr}](https://github.com/emqx/emqx/pull/${pr}) "
+    while read -r line; do
+        echo "${indent}${line}"
+        indent="  "
+    done < "${filename}"
+    echo
+}
+
+section() {
+    local section_name=$1
+    for i in "${changes_dir}"/"${section_name}"-*."${language}".md; do
+        item "${i}"
+    done
+}
+
+if [ "${language}" = "en" ]; then
+    cat <<EOF
+# ${version}
+
+## Enhancements
+
+$(section feat)
+
+## Bug fixes
+
+$(section fix)
+EOF
+elif [ "${language}" = "zh" ]; then
+     cat <<EOF
+# ${version}
+
+## 增强
+
+$(section feat)
+
+## 修复
+
+$(section fix)
+EOF
+else
+    echo "Invalid language ${language}" 1>&2;
+    exit 1
+fi

+ 9 - 0
scripts/rel/cut.sh

@@ -206,9 +206,18 @@ if [ -d "${CHECKS_DIR}" ]; then
     done
     done
 fi
 fi
 
 
+generate_changelog () {
+    local CHANGES_EN_MD="changes/${TAG}-en.md" CHANGES_ZH_MD="changes/${TAG}-zh.md"
+    ./scripts/format-changelog.sh "${TAG}" "en" > "$CHANGES_EN_MD"
+    ./scripts/format-changelog.sh "${TAG}" "zh" > "$CHANGES_ZH_MD"
+    git add "$CHANGES_EN_MD" "$CHANGES_ZH_MD"
+    [ -n "$(git status -s)" ] && git commit -m "chore: Generate changelog for ${TAG}"
+}
+
 if [ "$DRYRUN" = 'yes' ]; then
 if [ "$DRYRUN" = 'yes' ]; then
     logmsg "Release tag is ready to be created with command: git tag $TAG"
     logmsg "Release tag is ready to be created with command: git tag $TAG"
 else
 else
+    generate_changelog
     git tag "$TAG"
     git tag "$TAG"
     logmsg "$TAG is created OK."
     logmsg "$TAG is created OK."
 fi
 fi