[Actions] Limit Google Play changelog to 500 chars.

This commit is contained in:
Kuba Szczodrzyński 2021-04-06 21:50:51 +02:00
parent dd254d4bec
commit 3ae785a45c
No known key found for this signature in database
GPG Key ID: 70CB8A85BA1633CB

View File

@ -21,10 +21,8 @@ if __name__ == "__main__":
print("::set-output name=changelogDir::" + dir) print("::set-output name=changelogDir::" + dir)
(title, changelog) = get_changelog(project_dir, format="plain") (title, changelog) = get_changelog(project_dir, format="plain")
with open(dir + "whatsnew-pl-PL", "w", encoding="utf-8") as f:
f.write(changelog)
print("::set-output name=changelogPlainFile::" + dir + "whatsnew-pl-PL")
# plain text changelog - Firebase App Distribution
with open(dir + "whatsnew-titled.txt", "w", encoding="utf-8") as f: with open(dir + "whatsnew-titled.txt", "w", encoding="utf-8") as f:
f.write(title) f.write(title)
f.write("\n") f.write("\n")
@ -33,16 +31,31 @@ if __name__ == "__main__":
print("::set-output name=changelogTitle::" + title) print("::set-output name=changelogTitle::" + title)
# plain text changelog, max 500 chars - Google Play
with open(dir + "whatsnew-pl-PL", "w", encoding="utf-8") as f:
changelog_lines = changelog.split("\n")
changelog = ""
for line in changelog_lines:
if len(changelog) + len(line) < 500:
changelog += "\n" + line
changelog = changelog.strip()
f.write(changelog)
print("::set-output name=changelogPlainFile::" + dir + "whatsnew-pl-PL")
# markdown changelog - Discord webhook
(_, changelog) = get_changelog(project_dir, format="markdown") (_, changelog) = get_changelog(project_dir, format="markdown")
with open(dir + "whatsnew.md", "w", encoding="utf-8") as f: with open(dir + "whatsnew.md", "w", encoding="utf-8") as f:
f.write(changelog) f.write(changelog)
print("::set-output name=changelogMarkdownFile::" + dir + "whatsnew.md") print("::set-output name=changelogMarkdownFile::" + dir + "whatsnew.md")
# html changelog - version info in DB
(_, changelog) = get_changelog(project_dir, format="html") (_, changelog) = get_changelog(project_dir, format="html")
with open(dir + "whatsnew.html", "w", encoding="utf-8") as f: with open(dir + "whatsnew.html", "w", encoding="utf-8") as f:
f.write(changelog) f.write(changelog)
print("::set-output name=changelogHtmlFile::" + dir + "whatsnew.html") print("::set-output name=changelogHtmlFile::" + dir + "whatsnew.html")
changelog = get_commit_log(project_dir, format="plain", max_lines=10) changelog = get_commit_log(project_dir, format="plain", max_lines=10)
with open(dir + "commit_log.txt", "w", encoding="utf-8") as f: with open(dir + "commit_log.txt", "w", encoding="utf-8") as f:
f.write(changelog) f.write(changelog)