From 85994aaca50d468ce9113798c601f03800315c18 Mon Sep 17 00:00:00 2001 From: Antonio Aloisio Date: Fri, 24 May 2024 23:43:58 +0200 Subject: [PATCH] ci: add tools/get-last-notes.py --- tools/get-last-notes.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tools/get-last-notes.py diff --git a/tools/get-last-notes.py b/tools/get-last-notes.py new file mode 100644 index 00000000000..425e75c3047 --- /dev/null +++ b/tools/get-last-notes.py @@ -0,0 +1,33 @@ +#!/usr/bin/python3 +import re +from datetime import date +import os + +today=date.today() +CHANGELOG_FILE='Changelog-NG.txt' +MSG="""## GNUton's Asus Merlin changelog ##\n""" +TAGGED_RELEASE_ENV_NAME='CIRCLE_TAG' + +latest_release = None +latest_changes = list() + +with open(CHANGELOG_FILE) as f: + + rx = re.compile('^(\d[^()]+)\s.*$') + + for line in f: + release_search = rx.search(line) + + if release_search: + if latest_release: + break + else: + latest_release = os.getenv(TAGGED_RELEASE_ENV_NAME, release_search.group(1)) + else: + if latest_release: + latest_changes.append(line) + + print(MSG) + print('Date: %s' % today.strftime("%B %d, %Y")) + print('Release: %s\n' % latest_release) + print("".join(latest_changes))