ci: sync Joomla workflows + updates.xml from main
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
32
.github/workflows/auto-release.yml
vendored
32
.github/workflows/auto-release.yml
vendored
@@ -8,7 +8,7 @@
|
||||
# REPO: https://github.com/mokoconsulting-tech/MokoStandards
|
||||
# PATH: /templates/workflows/joomla/auto-release.yml.template
|
||||
# VERSION: 04.05.13
|
||||
# BRIEF: Joomla build & release — ZIP package, update.xml, SHA-256 checksum
|
||||
# BRIEF: Joomla build & release — ZIP package, updates.xml, SHA-256 checksum
|
||||
#
|
||||
# +========================================================================+
|
||||
# | BUILD & RELEASE PIPELINE (JOOMLA) |
|
||||
@@ -20,10 +20,10 @@
|
||||
# | 1. Read version from README.md |
|
||||
# | 3. Set platform version (Joomla <version>) |
|
||||
# | 4. Update [VERSION: XX.YY.ZZ] badges in markdown files |
|
||||
# | 5. Write update.xml (Joomla update server XML) |
|
||||
# | 5. Write updates.xml (Joomla update server XML) |
|
||||
# | 6. Create git tag vXX.YY.ZZ |
|
||||
# | 7a. Patch: update existing GitHub Release for this minor |
|
||||
# | 8. Build ZIP, upload asset, write SHA-256 to update.xml |
|
||||
# | 8. Build ZIP, upload asset, write SHA-256 to updates.xml |
|
||||
# | |
|
||||
# | Every version change: archives main -> version/XX.YY branch |
|
||||
# | Patch 00 = development (no release). First release = patch 01. |
|
||||
@@ -259,8 +259,8 @@ jobs:
|
||||
fi
|
||||
done
|
||||
|
||||
# -- STEP 5: Write update.xml (Joomla update server) ---------------------
|
||||
- name: "Step 5: Write update.xml"
|
||||
# -- STEP 5: Write updates.xml (Joomla update server) ---------------------
|
||||
- name: "Step 5: Write updates.xml"
|
||||
if: >-
|
||||
steps.version.outputs.skip != 'true' &&
|
||||
steps.check.outputs.already_released != 'true'
|
||||
@@ -271,7 +271,7 @@ jobs:
|
||||
# -- Parse extension metadata from XML manifest ----------------
|
||||
MANIFEST=$(find . -maxdepth 2 -name "*.xml" -exec grep -l '<extension' {} \; 2>/dev/null | head -1)
|
||||
if [ -z "$MANIFEST" ]; then
|
||||
echo "Warning: No Joomla XML manifest found — skipping update.xml" >> $GITHUB_STEP_SUMMARY
|
||||
echo "Warning: No Joomla XML manifest found — skipping updates.xml" >> $GITHUB_STEP_SUMMARY
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -316,7 +316,7 @@ jobs:
|
||||
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/v${VERSION}/${EXT_ELEMENT}-${VERSION}.zip"
|
||||
INFO_URL="https://github.com/${REPO}/releases/tag/v${VERSION}"
|
||||
|
||||
# -- Write update.xml (stable release) --------------------------
|
||||
# -- Write updates.xml (stable release) --------------------------
|
||||
{
|
||||
printf '%s\n' '<?xml version="1.0" encoding="utf-8"?>'
|
||||
printf '%s\n' '<updates>'
|
||||
@@ -341,9 +341,9 @@ jobs:
|
||||
printf '%s\n' ' <maintainerurl>https://mokoconsulting.tech</maintainerurl>'
|
||||
printf '%s\n' ' </update>'
|
||||
printf '%s\n' '</updates>'
|
||||
} > update.xml
|
||||
} > updates.xml
|
||||
|
||||
echo "update.xml: ${VERSION} (stable) — ${EXT_TYPE}/${EXT_ELEMENT}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "updates.xml: ${VERSION} (stable) — ${EXT_TYPE}/${EXT_ELEMENT}" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
# -- Commit all changes ---------------------------------------------------
|
||||
- name: Commit release changes
|
||||
@@ -472,19 +472,19 @@ jobs:
|
||||
gh release upload "$RELEASE_TAG" "/tmp/${PACKAGE_NAME}" 2>/dev/null || true
|
||||
}
|
||||
|
||||
# -- Update update.xml with SHA-256 for latest patch -------------
|
||||
if [ -f "update.xml" ]; then
|
||||
if grep -q '<sha256>' update.xml; then
|
||||
sed -i "s|<sha256>.*</sha256>|<sha256>sha256:${SHA256}</sha256>|" update.xml
|
||||
# -- Update updates.xml with SHA-256 for latest patch -------------
|
||||
if [ -f "updates.xml" ]; then
|
||||
if grep -q '<sha256>' updates.xml; then
|
||||
sed -i "s|<sha256>.*</sha256>|<sha256>sha256:${SHA256}</sha256>|" updates.xml
|
||||
else
|
||||
sed -i "s|</downloads>|</downloads>\n <sha256>sha256:${SHA256}</sha256>|" update.xml
|
||||
sed -i "s|</downloads>|</downloads>\n <sha256>sha256:${SHA256}</sha256>|" updates.xml
|
||||
fi
|
||||
|
||||
# Also update the download URL to point to this patch's ZIP
|
||||
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${RELEASE_TAG}/${PACKAGE_NAME}"
|
||||
sed -i "s|<downloadurl[^>]*>[^<]*</downloadurl>|<downloadurl type=\"full\" format=\"zip\">${DOWNLOAD_URL}</downloadurl>|" update.xml
|
||||
sed -i "s|<downloadurl[^>]*>[^<]*</downloadurl>|<downloadurl type=\"full\" format=\"zip\">${DOWNLOAD_URL}</downloadurl>|" updates.xml
|
||||
|
||||
git add update.xml
|
||||
git add updates.xml
|
||||
git commit -m "chore(release): SHA-256 + download URL for ${VERSION} [skip ci]" \
|
||||
--author="github-actions[bot] <github-actions[bot]@users.noreply.github.com>" || true
|
||||
git push || true
|
||||
|
||||
6
.github/workflows/ci-joomla.yml
vendored
6
.github/workflows/ci-joomla.yml
vendored
@@ -312,11 +312,11 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check update.xml exists
|
||||
if [ -f "update.xml" ] || [ -f "updates.xml" ]; then
|
||||
# Check updates.xml exists
|
||||
if [ -f "updates.xml" ] || [ -f "updates.xml" ]; then
|
||||
echo "Update XML present." >> $GITHUB_STEP_SUMMARY
|
||||
else
|
||||
echo "No update.xml found." >> $GITHUB_STEP_SUMMARY
|
||||
echo "No updates.xml found." >> $GITHUB_STEP_SUMMARY
|
||||
ERRORS=$((ERRORS + 1))
|
||||
fi
|
||||
|
||||
|
||||
6
.github/workflows/repo_health.yml
vendored
6
.github/workflows/repo_health.yml
vendored
@@ -595,9 +595,9 @@ jobs:
|
||||
joomla_findings+=("No .ini language files found")
|
||||
fi
|
||||
|
||||
# update.xml must exist in root (Joomla update server)
|
||||
if [ ! -f 'update.xml' ]; then
|
||||
joomla_findings+=("update.xml missing in root (required for Joomla update server)")
|
||||
# updates.xml must exist in root (Joomla update server)
|
||||
if [ ! -f 'updates.xml' ]; then
|
||||
joomla_findings+=("updates.xml missing in root (required for Joomla update server)")
|
||||
fi
|
||||
|
||||
# index.html files for directory listing protection
|
||||
|
||||
40
.github/workflows/update-server.yml
vendored
40
.github/workflows/update-server.yml
vendored
@@ -10,7 +10,7 @@
|
||||
# VERSION: 04.05.13
|
||||
# BRIEF: Update Joomla update server XML feed with stable/rc/dev entries
|
||||
#
|
||||
# Writes update.xml with multiple <update> entries:
|
||||
# Writes updates.xml with multiple <update> entries:
|
||||
# - <tag>stable</tag> on push to main (from auto-release)
|
||||
# - <tag>rc</tag> on push to rc/**
|
||||
# - <tag>development</tag> on push to dev/**
|
||||
@@ -47,7 +47,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
update-xml:
|
||||
name: Update update.xml
|
||||
name: Update updates.xml
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@@ -69,7 +69,7 @@ jobs:
|
||||
cd /tmp/mokostandards && composer install --no-dev --no-interaction --quiet 2>/dev/null || true
|
||||
fi
|
||||
|
||||
- name: Generate update.xml entry
|
||||
- name: Generate updates.xml entry
|
||||
run: |
|
||||
BRANCH="${{ github.ref_name }}"
|
||||
REPO="${{ github.repository }}"
|
||||
@@ -149,20 +149,20 @@ jobs:
|
||||
XMLEOF
|
||||
)
|
||||
|
||||
# ── Merge into update.xml ─────────────────────────────────────
|
||||
if [ ! -f "update.xml" ]; then
|
||||
# ── Merge into updates.xml ─────────────────────────────────────
|
||||
if [ ! -f "updates.xml" ]; then
|
||||
# Create fresh
|
||||
printf '%s\n' '<?xml version="1.0" encoding="utf-8"?>' > update.xml
|
||||
printf '%s\n' '<updates>' >> update.xml
|
||||
echo "$NEW_ENTRY" >> update.xml
|
||||
printf '%s\n' '</updates>' >> update.xml
|
||||
printf '%s\n' '<?xml version="1.0" encoding="utf-8"?>' > updates.xml
|
||||
printf '%s\n' '<updates>' >> updates.xml
|
||||
echo "$NEW_ENTRY" >> updates.xml
|
||||
printf '%s\n' '</updates>' >> updates.xml
|
||||
else
|
||||
# Remove existing entry for this stability, add new one
|
||||
# Use python for reliable XML manipulation
|
||||
python3 -c "
|
||||
import re, sys
|
||||
|
||||
with open('update.xml', 'r') as f:
|
||||
with open('updates.xml', 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
# Remove existing entry with this stability tag
|
||||
@@ -176,29 +176,29 @@ content = content.replace('</updates>', new_entry + '\n</updates>')
|
||||
# Clean up empty lines
|
||||
content = re.sub(r'\n{3,}', '\n\n', content)
|
||||
|
||||
with open('update.xml', 'w') as f:
|
||||
with open('updates.xml', 'w') as f:
|
||||
f.write(content)
|
||||
" 2>/dev/null || {
|
||||
# Fallback: just rewrite the whole file if python fails
|
||||
# Keep existing stable entry if present
|
||||
STABLE_ENTRY=""
|
||||
if [ "$STABILITY" != "stable" ] && grep -q '<tag>stable</tag>' update.xml; then
|
||||
STABLE_ENTRY=$(sed -n '/<update>/,/<\/update>/{ /<tag>stable<\/tag>/,/<\/update>/p; /<update>/,/<tag>stable<\/tag>/p }' update.xml | sort -u)
|
||||
if [ "$STABILITY" != "stable" ] && grep -q '<tag>stable</tag>' updates.xml; then
|
||||
STABLE_ENTRY=$(sed -n '/<update>/,/<\/update>/{ /<tag>stable<\/tag>/,/<\/update>/p; /<update>/,/<tag>stable<\/tag>/p }' updates.xml | sort -u)
|
||||
fi
|
||||
RC_ENTRY=""
|
||||
if [ "$STABILITY" != "rc" ] && grep -q '<tag>rc</tag>' update.xml; then
|
||||
if [ "$STABILITY" != "rc" ] && grep -q '<tag>rc</tag>' updates.xml; then
|
||||
RC_ENTRY=$(python3 -c "
|
||||
import re
|
||||
with open('update.xml') as f: c = f.read()
|
||||
with open('updates.xml') as f: c = f.read()
|
||||
m = re.search(r'(<update>.*?<tag>rc</tag>.*?</update>)', c, re.DOTALL)
|
||||
if m: print(m.group(1))
|
||||
" 2>/dev/null || true)
|
||||
fi
|
||||
DEV_ENTRY=""
|
||||
if [ "$STABILITY" != "development" ] && grep -q '<tag>development</tag>' update.xml; then
|
||||
if [ "$STABILITY" != "development" ] && grep -q '<tag>development</tag>' updates.xml; then
|
||||
DEV_ENTRY=$(python3 -c "
|
||||
import re
|
||||
with open('update.xml') as f: c = f.read()
|
||||
with open('updates.xml') as f: c = f.read()
|
||||
m = re.search(r'(<update>.*?<tag>development</tag>.*?</update>)', c, re.DOTALL)
|
||||
if m: print(m.group(1))
|
||||
" 2>/dev/null || true)
|
||||
@@ -212,16 +212,16 @@ if m: print(m.group(1))
|
||||
[ -n "$DEV_ENTRY" ] && echo "$DEV_ENTRY"
|
||||
echo "$NEW_ENTRY"
|
||||
printf '%s\n' '</updates>'
|
||||
} > update.xml
|
||||
} > updates.xml
|
||||
}
|
||||
fi
|
||||
|
||||
# Commit
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git add update.xml
|
||||
git add updates.xml
|
||||
git diff --cached --quiet || {
|
||||
git commit -m "chore: update update.xml (${STABILITY}: ${DISPLAY_VERSION}) [skip ci]" \
|
||||
git commit -m "chore: update updates.xml (${STABILITY}: ${DISPLAY_VERSION}) [skip ci]" \
|
||||
--author="github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
|
||||
git push
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user