Skip to content

Commit

Permalink
[Chore] Improve release doc (#16553)
Browse files Browse the repository at this point in the history
* improve release doc
  • Loading branch information
SbloodyS authored Aug 30, 2024
1 parent d64837d commit deddb3b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ dolphinscheduler-common/test
dolphinscheduler-worker/logs
dolphinscheduler-master/logs
dolphinscheduler-api/logs
__pycache__
2 changes: 1 addition & 1 deletion docs/docs/en/contribute/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/zh/contribute/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 中
Expand Down
2 changes: 1 addition & 1 deletion tools/release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 18 additions & 2 deletions tools/release/github/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -35,6 +35,7 @@ class Changelog:
key_labels = "labels"
key_name = "name"

label_dsip = "dsip"
label_feature = "feature"
label_bug = "bug"
label_improvement = "improvement"
Expand All @@ -46,6 +47,7 @@ class Changelog:

def __init__(self, prs: List[Dict]):
self.prs = prs
self.dsips = []
self.features = []
self.bugfixs = []
self.improvements = []
Expand All @@ -57,6 +59,9 @@ def generate(self) -> str:
"""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)
Expand Down Expand Up @@ -98,7 +103,9 @@ def classify(self) -> None:
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)
Expand All @@ -111,6 +118,15 @@ def classify(self) -> None:
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(
Expand Down
6 changes: 5 additions & 1 deletion tools/release/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -103,4 +103,8 @@ def build_argparse() -> argparse.ArgumentParser:
"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))

0 comments on commit deddb3b

Please sign in to comment.