diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index bdf8bb74ac..d98a132695 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -62,10 +62,14 @@ jobs: run: | echo "release_title=$(git show --format=%s --no-patch | head -1)" >> $GITHUB_OUTPUT echo "release_version=v${{ steps.version.outputs.value }}_$(TZ=Asia/Shanghai date +'%Y%m%d')_syv${{ steps.syv.outputs.value }}" >> $GITHUB_OUTPUT - changelog=$(python scripts/parse-changelog-sillot.py -t ${{ github.ref }} -b ${{ steps.thislatestR.outputs.release }} Hi-Windom/Sillot) + changelog1=$(python scripts/parse-changelog-HEAD.py -t ${{ github.ref }} -b ${{ steps.thislatestR.outputs.release }} Hi-Windom/Sillot) + changelog2=$(python scripts/parse-changelog-sillot.py -t ${{ github.ref }} Hi-Windom/Sillot) + changelog3=$(python scripts/parse-changelog-sillot.py -t ${{ github.ref }} Hi-Windom/Sillot-android) EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) echo "release_body_sillot<<$EOF" >> $GITHUB_ENV - echo "$changelog" >> $GITHUB_ENV + echo "$changelog1" >> $GITHUB_ENV + echo "$changelog2" >> $GITHUB_ENV + echo "$changelog3" >> $GITHUB_ENV echo "$EOF" >> $GITHUB_ENV env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/app/package.json b/app/package.json index 5f39423b7a..057904cd4d 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "sillot", - "version": "0.27.18", + "version": "0.27.19", "syv": "3.0.5", "sypv": "3.0.4", "description": "Build Your Eternal Digital Garden", diff --git a/scripts/parse-changelog-HEAD.py b/scripts/parse-changelog-HEAD.py new file mode 100644 index 0000000000..89ffbe78e5 --- /dev/null +++ b/scripts/parse-changelog-HEAD.py @@ -0,0 +1,61 @@ +import os +import re +from argparse import ArgumentParser +from collections import defaultdict + +import github # pip install PyGithub + +# ensure the milestone is open before run this +docmap = { + "Feature": "引入特性 | Feature", + "Enhancement": "改进功能 | Enhancement", + "Bug": "修复错误 | Bugfix", + "Security": "安全相关 | Security", + "Document": "文档相关 | Document", + "Refactor": "开发重构 | Refactor", + "Abolishment": "移除废止 | Abolishment", + "Shinning": "闪亮之名 | Shinning", +} + + +def generate_msg_from_repo(repo_name, tag_name, lastestRelease): + thisRelease = tag_name.split("/")[-1] + pat = re.search("v([0-9.]+)", thisRelease) + if not pat: + return None + + print(f''' +--- +
+ +⚠️ 这是自动构建的开发者版本!数据无价,请勿用于生产环节 +❤️ 欢迎共建汐洛 694357845@qq.com +🚧 [{repo_name} is currently in active development](https://github.com/orgs/Hi-Windom/projects/2/views/2) + +🚢 [Docker image](https://hub.docker.com/r/soltus/sillot/tags?page=1&ordering=last_updated) 📱 [Android application package](https://github.com/Hi-Windom/Sillot-android/releases) 📦 [Chromium Browser Extension](https://github.com/K-Sillot/Sillot-Be/releases) + + + + +--- + +''') + + +if __name__ == "__main__": + parser = ArgumentParser( + description="Automaticly generate information from issues by tag." + ) + parser.add_argument("-t", "--tag", help="the tag to filter issues.") + parser.add_argument("-b", "--lastestRelease", help="lastest Release") + parser.add_argument("repo", help="The repository name") + args = parser.parse_args() + + try: + generate_msg_from_repo(args.repo, args.tag, args.lastestRelease) + except AssertionError: + print(args.tag) diff --git a/scripts/parse-changelog-sillot.py b/scripts/parse-changelog-sillot.py index def7a0cd4c..71abc5ba67 100644 --- a/scripts/parse-changelog-sillot.py +++ b/scripts/parse-changelog-sillot.py @@ -29,6 +29,7 @@ def generate_msg_from_repo(repo_name, tag_name, lastestRelease): repo_name (str): The repository name tag_name (str): the tag name """ + print(f'# [@{repo_name.split("/")[-1]}](https://github.com/{repo_name})\n') hostname = os.getenv("GITHUB_HOST") or "api.github.com" token = os.getenv("GITHUB_TOKEN") desc_mapping = defaultdict(list) @@ -45,7 +46,7 @@ def generate_msg_from_repo(repo_name, tag_name, lastestRelease): generate_msg(desc_mapping) -def find_milestone(repo, title, lastestRelease): +def find_milestone(repo, title): """Find the milestone in a repository that is similar to milestone title Args: @@ -61,26 +62,7 @@ def find_milestone(repo, title, lastestRelease): if not pat: return None version = ".".join(pat.group(1).split(".")[:2]) - print(f''' ---- - - -⚠️ 这是自动构建的开发者版本!数据无价,请勿用于生产环节 -❤️ 欢迎共建汐洛 694357845@qq.com -🚧 [Sillot is currently in active development](https://github.com/orgs/Hi-Windom/projects/2/views/2) - -🚢 [Docker image](https://hub.docker.com/r/soltus/sillot/tags?page=1&ordering=last_updated) 📱 [Android application package](https://github.com/Hi-Windom/Sillot-android/releases) 📦 [Chromium Browser Extension](https://github.com/K-Sillot/Sillot-Be/releases) - - - - ---- - -''') + # REF https://docs.github.com/en/rest/issues/milestones?apiVersion=2022-11-28#list-milestones for milestone in repo.get_milestones(): if version in milestone.title: @@ -101,7 +83,6 @@ def get_issue_first_label(issue): def generate_msg(desc_mapping): """Print changelogs from direction.""" print() - print('# [@Sillot](https://github.com/Hi-Windom/Sillot)\n') for header in docmap: if not desc_mapping[header]: continue