Skip to content

Commit

Permalink
#1: Add unreleased title when the script update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
shalithasuranga committed Dec 29, 2021
1 parent 3dca60f commit 274d124
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ rename `Unreleased` topic with the new version tag. Finally, create a new `Unrel

Wait!, you don't need to do this manually - use [ReleaseZri](https://github.com/codezri/releasezri)

## Unreleased

### Core: script
- Add `## Unreleased` while updating the changelog with the latest version

## v1.0.3

### Core: template
Expand Down
14 changes: 8 additions & 6 deletions scripts/rz.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,25 @@ def save_release_note(note):

def update_changelog():
updated_changelog = ''
pre_replace = '''## Unreleased
'''
with open(CHANGELOG_FILE, 'r') as cf:
updated_changelog = cf.read().replace('## Unreleased', '## ' + VERSION)
replace_text = pre_replace + '## ' + VERSION
updated_changelog = cf.read().replace('## Unreleased', replace_text)

with open(CHANGELOG_FILE, 'w') as cf:
cf.write(updated_changelog)

def create_note():
print('INFO: Preparing release notes...')
note = parse_release_note()
if note.strip() == '':
print('ERROR: No changelog so far.')
sys.exit(1)
print('---- Release note for %s (parsed) ----' % VERSION)
print(note)
print('----')

if note == '':
print('ERROR: No changelog.')
sys.exit(1)

note = apply_notes_to_template(note)
print('---- Release note for %s (applied to template) ----' % VERSION)
print(note)
Expand Down

0 comments on commit 274d124

Please sign in to comment.