From a464bf1027572fced9b6f0a2fb54c51244a6876e Mon Sep 17 00:00:00 2001 From: Shalitha Suranga Date: Sun, 17 Apr 2022 22:56:34 +0530 Subject: [PATCH] Add --top option to set release note alerts --- .releasezri/template.md | 2 ++ CHANGELOG.md | 4 ++++ scripts/rz.py | 12 ++++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.releasezri/template.md b/.releasezri/template.md index 80b3272..93d50cd 100644 --- a/.releasezri/template.md +++ b/.releasezri/template.md @@ -1,3 +1,5 @@ +{RZ_TOP} + ## What's new {RZ_CHANGELOG} diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ec9bd3..a6daddd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Wait!, you don't need to do this manually - use [ReleaseZri](https://github.com/ ## Unreleased +### Core: script +- Add `RZ_TOP` template variable and set it via `--top=`. This feature is helpful for adding +important messages about releases. i.e, Nightly build warning. + ## v1.2.0 ### Core: script diff --git a/scripts/rz.py b/scripts/rz.py index 52b2a9d..08c15fc 100755 --- a/scripts/rz.py +++ b/scripts/rz.py @@ -10,10 +10,16 @@ CHANGELOG_FILE = './CHANGELOG.md' TMP_DIR = './.tmprz' RELEASE_NOTE_FILE = './.tmprz/release_notes.md' -RZ_VERSION = '1.2.0' +RZ_VERSION = '1.3.0' VERSION = '' VERSION_WITH_V = '' +def get_cli_option_value(option): + for arg in sys.argv: + if option in arg: + return arg.split('=')[1] + return '' + def apply_notes_to_template(note): md = '' today = datetime.today() @@ -23,7 +29,9 @@ def apply_notes_to_template(note): .replace('{RZ_VERSION}', VERSION) \ .replace('{RZ_DATE}', today.strftime('%Y-%m-%d')) \ .replace('{RZ_TIME}', today.strftime('%H:%M:%S')) \ - .replace('{RZ_CHANGELOG}', note) + .replace('{RZ_CHANGELOG}', note) \ + .replace('{RZ_TOP}', get_cli_option_value('--top')) \ + .strip() return md def parse_release_note():