Browse Source

[Chore] Improve release doc (#16553)

* improve release doc
dev
xiangzihao 3 months ago committed by GitHub
parent
commit
deddb3bbca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      .gitignore
  2. 2
      docs/docs/en/contribute/release.md
  3. 2
      docs/docs/zh/contribute/release.md
  4. 2
      tools/release/README.md
  5. 20
      tools/release/github/changelog.py
  6. 6
      tools/release/release.py

1
.gitignore vendored

@ -53,3 +53,4 @@ dolphinscheduler-common/test
dolphinscheduler-worker/logs
dolphinscheduler-master/logs
dolphinscheduler-api/logs
__pycache__

2
docs/docs/en/contribute/release.md

@ -386,7 +386,7 @@ Decompress `apache-dolphinscheduler-<VERSION>-bin.tar.gz` to check the following
You should create a release note in GitHub by [new release note](https://github.com/apache/dolphinscheduler/releases/new).
It should be done before vote mail because we need the release note in the mail. You could use command
`python release.py changelog` in directory `tools/release` to creat the changelog.
`python release.py changelog` in directory `tools/release` to creat the changelog.([Usage](https://github.com/apache/dolphinscheduler/blob/dev/tools/release/README.md)
> NOTE: Or if you prefer to create manually, you can use command `git log --pretty="- %s" <PREVIOUS-RELEASE-SHA>..<CURRENT-RELEASE-SHA> > changelog.md`
> (some log maybe not correct, you should filter them by yourself) and classify them and paste them to GitHub release note page

2
docs/docs/zh/contribute/release.md

@ -393,7 +393,7 @@ svn --username="${A_USERNAME}" commit -m "release ${VERSION}"
在 GitHub 中通过 [创建新的 release note](https://github.com/apache/dolphinscheduler/releases/new) 创建一个 release note。 这要在
投票邮件开始之前完成,因为我们需要在邮件中使用 release note。你可以在 `tools/release` 目录中运行 `python release.py changelog` 自动创建
changelog.
changelog.([使用方式](https://github.com/apache/dolphinscheduler/blob/dev/tools/release/README.md))
> 备注: 如果你更加倾向于手动创建 changelog,你可以通过命令 `git log --pretty="- %s" <PREVIOUS-RELEASE-SHA>..<CURRENT-RELEASE-SHA> > changelog.md`
> 生成 changelog(部分可以不太准确,需要人为过滤一遍),然后将他们分类并粘贴到 GitHub 的 release note 中

2
tools/release/README.md

@ -4,7 +4,7 @@ A tools for convenient release DolphinScheduler.
## Prepare
* python: python 3.6 or above
* python: python 3.6 or higher
* pip: latest version of pip is better
To install dependence, you should run command

20
tools/release/github/changelog.py

@ -25,7 +25,7 @@ class Changelog:
Each pull requests will only once in final result. If pull requests have more than one label we need,
will classify to high priority label type, currently priority is
`feature > bug > improvement > document > chore`. pr will into feature section if it with both `feature`,
`dsip > feature > bug > improvement > document > chore`. pr will into feature section if it with both `feature`,
`improvement`, `document` label.
:param prs: pull requests list.
@ -35,6 +35,7 @@ class Changelog:
key_labels = "labels"
key_name = "name"
label_dsip = "dsip"
label_feature = "feature"
label_bug = "bug"
label_improvement = "improvement"
@ -46,6 +47,7 @@ class Changelog:
def __init__(self, prs: List[Dict]):
self.prs = prs
self.dsips = []
self.features = []
self.bugfixs = []
self.improvements = []
@ -57,6 +59,9 @@ class Changelog:
"""Generate changelog."""
self.classify()
final = []
if self.dsips:
detail = f"## DSIP{self.changelog_prefix}{self._convert(self.dsips)}{self.changelog_suffix}"
final.append(detail)
if self.features:
detail = f"## Feature{self.changelog_prefix}{self._convert(self.features)}{self.changelog_suffix}"
final.append(detail)
@ -98,7 +103,9 @@ class Changelog:
for pr in self.prs:
if self.key_labels not in pr:
raise KeyError("PR %s do not have labels", pr[self.key_number])
if self._is_feature(pr):
if self._is_dsip(pr):
self.dsips.append(pr)
elif self._is_feature(pr):
self.features.append(pr)
elif self._is_bugfix(pr):
self.bugfixs.append(pr)
@ -111,6 +118,15 @@ class Changelog:
else:
self.others.append(pr)
def _is_dsip(self, pr: Dict) -> bool:
"""Belong to dsip pull requests."""
return any(
[
label[self.key_name].lower() == self.label_dsip
for label in pr[self.key_labels]
]
)
def _is_feature(self, pr: Dict) -> bool:
"""Belong to feature pull requests."""
return any(

6
tools/release/release.py

@ -92,7 +92,7 @@ def build_argparse() -> argparse.ArgumentParser:
if __name__ == "__main__":
arg_parser = build_argparse()
# args = arg_parser.parse_args(["cherry-pick"])
# args = arg_parser.parse_args(["changelog"])
args = arg_parser.parse_args()
ENV_ACCESS_TOKEN = os.environ.get("GH_ACCESS_TOKEN", None)
@ -103,4 +103,8 @@ if __name__ == "__main__":
"Environment variable `GH_ACCESS_TOKEN` and `GH_REPO_MILESTONE` must provider"
)
if not hasattr(args, "func"):
arg_parser.print_help()
exit(1)
print(args.func(ENV_ACCESS_TOKEN, ENV_MILESTONE))

Loading…
Cancel
Save