In the end was as @Stephen Kitt said:
#!/usr/bin/env bash UPSTREAM_VERSION=$(cat VERSION) echo "Adding new Debian changelog entry for version $UPSTREAM_VERSION." DEB_VERSION="$UPSTREAM_VERSION-0debian1~unstable1" if [ -f DEBEMAIL ];then DEBEMAIL_VAL=$(cat DEBEMAIL) fi DEBEMAIL_VAL=$(dialog --inputbox "Enter your email:" 8 50 "$DEBEMAIL_VAL" 3>&1 1>&2 2>&3) if [ ! -z "$DEBEMAIL_VAL" ]; then echo $DEBEMAIL_VAL > DEBEMAIL fi export DEBEMAIL=$DEBEMAIL_VAL dch --distribution unstable --newversion $DEB_VERSION -m "" while IFS= read -r line; do echo $line; dch -a "$line" done < RELEASE_NOTES # Prompt user to edit Debian changelog $EDITOR_CHOICE "$DEBIAN_CHANGELOG" echo "Version updated successfully: $UPSTREAM_VERSION" For this, you need to init the version by calling:
dch --newversion "$DEB_VERSION" Then for each line in the file RELEASE_NOTES we need to call:
dch --newversion "$DEB_VERSION" -a "$line" This appends a line upon the debian/changelog file, then we finalize the line:
dch --newversion "$DEB_VERSION" --distribution unstable ignored Then the release needs to be finalized as:
dch --newversion "$DEB_VERSION" --distribution unstable ignored In your example, this will result this changelog entry:
mkdotenv (0.2.0-0debian1-unstable1) unstable; urgency=medium [ John Doe ] * 1. Split codebase into multiple files. * 2. Use a seperate version file and define built version upon compile. * 4. [BUGFIX] If input file is same as output file copy input file into a temporary one. * 5. Improved Documentation -- username <username@hostname> Mon, 10 Mar 2025 22:01:07 +0200 Update 25/3/2025
Some lines were omitted if not DEBEMAIL env var exported, therefore I made a small prompt for the user to enter his/her email and store it upon DEBEMAIL file.