Reorganization

This commit is contained in:
2025-12-16 15:15:36 -06:00
parent feac5973cf
commit 94f3c457ec
76 changed files with 886 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
#!/usr/bin/env bash
set -euo pipefail
# scripts/update_changelog.sh
#
# Purpose:
# - Apply the MokoWaaS-Brand CHANGELOG template entry for a given version.
# - Insert a new header at the top of CHANGELOG.md, immediately after "# Changelog".
# - Avoid duplicates if an entry for the version already exists.
# - Preserve the rest of the file verbatim.
#
# Usage:
# ./scripts/update_changelog.sh <VERSION>
#
# Example:
# ./scripts/update_changelog.sh 01.05.00
VERSION="${1:-}"
if [[ -z "${VERSION}" ]]; then
echo "ERROR: Version argument is required. Usage: scripts/update_changelog.sh <VERSION>" >&2
exit 1
fi
CHANGELOG_FILE="CHANGELOG.md"
DATE_UTC="$(date -u +"%Y-%m-%d")"
HEADER="## ${VERSION} - ${DATE_UTC}"
if [[ ! -f "${CHANGELOG_FILE}" ]]; then
{
echo "# Changelog"
echo
} > "${CHANGELOG_FILE}"
fi
# Do not duplicate existing entries
if grep -qE "^##[[:space:]]+${VERSION}[[:space:]]+-[[:space:]]+" "${CHANGELOG_FILE}"; then
echo "CHANGELOG.md already contains an entry for ${VERSION}. No changes made."
exit 0
fi
TMP_FILE="${CHANGELOG_FILE}.tmp"
# Insert after the first '# Changelog' line.
# If '# Changelog' is missing, prepend it.
if grep -qE "^# Changelog$" "${CHANGELOG_FILE}"; then
awk -v header="${HEADER}" '
BEGIN { inserted=0 }
{
print
if (!inserted && $0 ~ /^# Changelog$/) {
print ""
print header
print ""
inserted=1
}
}
END {
if (!inserted) {
# fallback: append at end
print ""
print header
print ""
}
}
' "${CHANGELOG_FILE}" > "${TMP_FILE}"
else
{
echo "# Changelog"
echo
echo "${HEADER}"
echo
cat "${CHANGELOG_FILE}"
} > "${TMP_FILE}"
fi
mv "${TMP_FILE}" "${CHANGELOG_FILE}"
echo "Applied changelog header: ${HEADER}"

View File

@@ -0,0 +1,42 @@
#!/bin/bash
set -e
MANIFEST="src/mokowaasbrand.xml"
echo "Validating Joomla manifest: $MANIFEST"
if [ ! -f "$MANIFEST" ]; then
echo "ERROR: Manifest not found: $MANIFEST"
exit 1
fi
# Check XML syntax
if ! xmllint --noout "$MANIFEST"; then
echo "ERROR: Manifest XML is not valid."
exit 1
fi
# Required fields
REQUIRED_NODES=(
"//extension"
"//name"
"//version"
"//author"
"//creationDate"
)
for NODE in "${REQUIRED_NODES[@]}"; do
if ! xmllint --xpath "$NODE" "$MANIFEST" > /dev/null 2>&1; then
echo "ERROR: Required manifest node missing: $NODE"
exit 1
fi
done
VERSION=$(xmllint --xpath "string(//version)" "$MANIFEST")
if [ -z "$VERSION" ]; then
echo "ERROR: Version node is empty in manifest."
exit 1
fi
echo "Manifest OK. Version: $VERSION"

View File

@@ -0,0 +1,25 @@
#!/bin/bash
set -e
echo "Running changelog verifier"
BRANCH="${GITHUB_REF_NAME}"
if [[ ! "$BRANCH" =~ ^version/ ]]; then
echo "Not on a version branch. Skipping changelog verification."
exit 0
fi
VERSION="${BRANCH#version/}"
if [ ! -f "CHANGELOG.md" ]; then
echo "ERROR: CHANGELOG.md does not exist."
exit 1
fi
if ! grep -q "$VERSION" CHANGELOG.md; then
echo "ERROR: CHANGELOG.md missing entry for version $VERSION"
exit 1
fi
echo "Changelog contains correct version section."