diff --git a/templates/workflows/joomla/auto-release.yml.template b/templates/workflows/joomla/auto-release.yml.template
index 5b25e60..94799c3 100644
--- a/templates/workflows/joomla/auto-release.yml.template
+++ b/templates/workflows/joomla/auto-release.yml.template
@@ -323,8 +323,9 @@ jobs:
DOWNLOAD_URL="${GITEA_URL}/${GITEA_ORG}/${GITEA_REPO}/releases/download/v${VERSION}/${EXT_ELEMENT}-${VERSION}.zip"
INFO_URL="${GITEA_URL}/${GITEA_ORG}/${GITEA_REPO}/releases/tag/v${VERSION}"
- # -- Build stable entry to temp file
- {
+ # -- Build update entry for a given stability tag
+ build_entry() {
+ local TAG_NAME="$1"
printf '%s\n' ' '
printf '%s\n' " ${EXT_NAME}"
printf '%s\n' " ${EXT_NAME} update"
@@ -333,9 +334,7 @@ jobs:
printf '%s\n' " ${VERSION}"
[ -n "$CLIENT_TAG" ] && printf '%s\n' " ${CLIENT_TAG}"
[ -n "$FOLDER_TAG" ] && printf '%s\n' " ${FOLDER_TAG}"
- printf '%s\n' ' '
- printf '%s\n' ' stable'
- printf '%s\n' ' '
+ printf '%s\n' " ${TAG_NAME}"
printf '%s\n' " ${INFO_URL}"
printf '%s\n' ' '
printf '%s\n' " ${DOWNLOAD_URL}"
@@ -345,34 +344,22 @@ jobs:
printf '%s\n' ' Moko Consulting'
printf '%s\n' ' https://mokoconsulting.tech'
printf '%s\n' ' '
- } > /tmp/stable_entry.xml
-
- # -- Write updates.xml preserving dev/rc entries
- # Extract existing entries for other stability levels
- if [ -f "updates.xml" ]; then
- printf 'import re, sys\n' > /tmp/extract.py
- printf 'with open("updates.xml") as f: c = f.read()\n' >> /tmp/extract.py
- printf 'tag = sys.argv[1]\n' >> /tmp/extract.py
- printf 'm = re.search(r"( .*?" + re.escape(tag) + r".*?)", c, re.DOTALL)\n' >> /tmp/extract.py
- printf 'if m: print(m.group(1))\n' >> /tmp/extract.py
- fi
- DEV_ENTRY=$(python3 /tmp/extract.py development 2>/dev/null || true)
- ALPHA_ENTRY=$(python3 /tmp/extract.py alpha 2>/dev/null || true)
- BETA_ENTRY=$(python3 /tmp/extract.py beta 2>/dev/null || true)
- RC_ENTRY=$(python3 /tmp/extract.py rc 2>/dev/null || true)
+ }
+ # -- Write updates.xml with cascading channels
+ # Stable release updates ALL channels (development, alpha, beta, rc, stable)
{
printf '%s\n' ''
printf '%s\n' ''
- [ -n "$DEV_ENTRY" ] && echo "$DEV_ENTRY"
- [ -n "$ALPHA_ENTRY" ] && echo "$ALPHA_ENTRY"
- [ -n "$BETA_ENTRY" ] && echo "$BETA_ENTRY"
- [ -n "$RC_ENTRY" ] && echo "$RC_ENTRY"
- cat /tmp/stable_entry.xml
+ build_entry "development"
+ build_entry "alpha"
+ build_entry "beta"
+ build_entry "rc"
+ build_entry "stable"
printf '%s\n' ''
} > updates.xml
- echo "updates.xml: ${VERSION} (stable + rc/dev preserved)" >> $GITHUB_STEP_SUMMARY
+ echo "updates.xml: ${VERSION} (all channels updated to stable)" >> $GITHUB_STEP_SUMMARY
# -- Commit all changes ---------------------------------------------------
- name: Commit release changes
diff --git a/templates/workflows/joomla/update-server.yml.template b/templates/workflows/joomla/update-server.yml.template
index eded1e1..6dca78e 100644
--- a/templates/workflows/joomla/update-server.yml.template
+++ b/templates/workflows/joomla/update-server.yml.template
@@ -283,23 +283,45 @@ jobs:
printf '%b' "$NEW_ENTRY" > /tmp/new_entry.xml
# -- Merge into updates.xml (only update this stability channel) -
+ # Cascading update: each stability level updates itself and all lower levels
+ # stable → all | rc → rc,beta,alpha,dev | beta → beta,alpha,dev | alpha → alpha,dev | dev → dev
+ CASCADE_MAP="stable:development,alpha,beta,rc,stable rc:development,alpha,beta,rc beta:development,alpha,beta alpha:development,alpha development:development"
+ TARGETS=""
+ for entry in $CASCADE_MAP; do
+ key="${entry%%:*}"
+ vals="${entry#*:}"
+ if [ "$key" = "${STABILITY}" ]; then
+ TARGETS="$vals"
+ break
+ fi
+ done
+ [ -z "$TARGETS" ] && TARGETS="${STABILITY}"
+
if [ ! -f "updates.xml" ]; then
printf '%s\n' '' > updates.xml
printf '%s\n' '' >> updates.xml
cat /tmp/new_entry.xml >> updates.xml
printf '\n%s\n' '' >> updates.xml
else
- # Remove existing entry for this stability, insert new one
+ # Replace each cascading channel with the new entry (different tag)
+ export PY_TARGETS="$TARGETS"
python3 << PYEOF
- import re
+ import re, os
+ targets = os.environ["PY_TARGETS"].split(",")
stability = "${STABILITY}"
with open("updates.xml") as f:
content = f.read()
with open("/tmp/new_entry.xml") as f:
- new_entry = f.read()
- pattern = r" .*?" + re.escape(stability) + r".*?\n?"
- content = re.sub(pattern, "", content, flags=re.DOTALL)
- content = content.replace("", new_entry + "\n")
+ new_entry_template = f.read()
+ for tag in targets:
+ tag = tag.strip()
+ # Build entry with this tag
+ new_entry = re.sub(r"[^<]*", f"{tag}", new_entry_template)
+ # Remove existing entry for this tag
+ pattern = r" .*?" + re.escape(tag) + r".*?\n?"
+ content = re.sub(pattern, "", content, flags=re.DOTALL)
+ # Insert before
+ content = content.replace("", new_entry + "\n")
content = re.sub(r"\n{3,}", "\n\n", content)
with open("updates.xml", "w") as f:
f.write(content)