diff --git a/.woodpecker.yml b/.woodpecker.yml index 2200e22..037cbf9 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -44,6 +44,7 @@ pipeline: api_key: from_secret: gitea_token base_url: https://gitea.zionetrix.net + note: dist/release_notes.md files: - gitdch - dist/*.deb diff --git a/build.sh b/build.sh index f6ed6e0..9e4e586 100755 --- a/build.sh +++ b/build.sh @@ -48,6 +48,7 @@ fi --version "${VERSION}" \ --code-name $DEBIAN_CODENAME \ --output $BDIR/debian/changelog \ + --release-notes dist/release_notes.md \ "${GITDCH_ARGS[@]}" if [ -n "$MAINTAINER_NAME" -a -n "$MAINTAINER_EMAIL" ] diff --git a/gitdch b/gitdch index 5889732..eb55f18 100755 --- a/gitdch +++ b/gitdch @@ -126,6 +126,15 @@ parser.add_argument( help='Maintainer email (default: last commit author email)' ) +parser.add_argument( + '-R', + '--release-notes', + type=str, + dest='release_notes', + help='Specify the Markdown release notes output path (default: not generated)', +) + + options = parser.parse_args() if not options.package_name: @@ -258,3 +267,14 @@ if options.output: fd.writelines(changelog_lines) else: print(''.join(changelog_lines)) + +if options.release_notes: + log.info('Generate Markdown release notes') + release_notes_lines = [f'# Changelog:\n\n'] + release_notes_lines.extend([ + f'* {message}\n' + for message in versions[0]['messages'] + ]) + log.info('Write generated Markdown release notes in file %s', options.release_notes) + with open(options.release_notes, 'w', encoding='utf8') as fd: + fd.writelines(release_notes_lines)