release automation: gitea actions build every push and publish tagged releases (version from the tag, packages, sha256sums, changelog section as text), simple 5-step install guide in the readme

This commit is contained in:
MineTec committed 2026-11-07 16:47:42 +01:00
1 parent f5fd411592
commit a64df88c77
7 files changed
+262 -9

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env python3
"""Prints the CHANGELOG.md section of one version (used as the release text).
changelog_section.py 0.2.1 [CHANGELOG.md]
A section starts at a "## <version>" heading (anything may follow the version, e.g. " – changes
since 0.1.0") and ends before the next "## " heading. Exit code 1 if the version has no section.
"""
import re
import sys
def section(text, version):
out, inside = [], False
for line in text.splitlines():
if line.startswith("## "):
if inside:
break
inside = re.match(r"## v?" + re.escape(version) + r"(\s|$)", line) is not None
continue
if inside:
out.append(line)
return "\n".join(out).strip() if inside or out else None
def main():
if len(sys.argv) < 2:
sys.exit(__doc__)
path = sys.argv[2] if len(sys.argv) > 2 else "CHANGELOG.md"
with open(path, encoding="utf-8") as f:
s = section(f.read(), sys.argv[1])
if not s:
sys.exit("no section for version %s in %s" % (sys.argv[1], path))
print(s)
if __name__ == "__main__":
main()