.github: Add function for generating changelogs

The function only generates the update kind of changelogs. If the
update addresses some CVE, it needs to be added manually.

The changelog generation happens only if the changelog directory
exists. Also make sure it's included in the patches.
This commit is contained in:
Krzesimir Nowak 2021-12-02 10:30:14 +01:00
parent b81564c749
commit 2c33dcef76

View File

@ -64,6 +64,19 @@ function regenerate_manifest() {
popd || exit
}
function generate_update_changelog() {
local NAME="${1}"
local VERSION="${2}"
local URL="${3}"
local UPDATE_NAME="${4}"
pushd "${SDK_OUTER_SRCDIR}/third_party/coreos-overlay" >/dev/null || exit
if [[ -d changelog/updates ]]; then
echo "- ${NAME} ([${VERSION}](${URL}))" > "changelog/updates/$(date '+%Y-%m-%d')-${UPDATE_NAME}-update.md"
fi
popd >/dev/null || exit
}
function generate_patches() {
CATEGORY_NAME=$1
PKGNAME_SIMPLE=$2
@ -78,6 +91,9 @@ function generate_patches() {
# We can only create the actual commit in the actual source directory, not under the SDK.
# So create a format-patch, and apply to the actual source.
git add ${CATEGORY_NAME}/${PKGNAME_SIMPLE}
if [[ -d changelog ]]; then
git add changelog
fi
for dir in "$@"; do
git add "${dir}"
done