From d82abdbef941949e7cf05f34a3efda046b1450e4 Mon Sep 17 00:00:00 2001
From: Rafael Guterres Jeffman <rjeffman@redhat.com>
Date: Tue, 10 May 2022 16:06:22 -0300
Subject: [PATCH] build-galaxy-release: Automatically create CHANGELOG.

Recent versions of ansible-test require the existence of a CHANGELOG
file in the root of the collection. This changes extracts the changes
of the latest available release tag using `utils/changelog` and create
the CHANGELOG file with the result of the command.

The generated changelog will include the changes for the latest release
and, if present, the available changes that were not part of a release.
---
 utils/build-galaxy-release.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/utils/build-galaxy-release.sh b/utils/build-galaxy-release.sh
index 1e4f8832..a708d674 100755
--- a/utils/build-galaxy-release.sh
+++ b/utils/build-galaxy-release.sh
@@ -107,6 +107,11 @@ sed -i -e "s/name: .*/name: \"$collection\"/" galaxy.yml
 
 find . -name "*~" -exec rm {} \;
 
+
+echo "Creating CHANGELOG.rst..."
+"$(dirname "$0")/changelog" --galaxy > CHANGELOG.rst
+echo -e "\033[ACreating CHANGELOG.rst... \033[32;1mDONE\033[0m"
+
 sed -i -e "s/ansible.module_utils.ansible_freeipa_module/ansible_collections.${collection_prefix}.plugins.module_utils.ansible_freeipa_module/" plugins/modules/*.py
 
 (cd plugins/module_utils && {
-- 
GitLab