ci: sync workflows [skip ci]
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
26
.github/workflows/auto-dev-issue.yml
vendored
26
.github/workflows/auto-dev-issue.yml
vendored
@@ -156,30 +156,22 @@ jobs:
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── RC: Create or update draft release ────────────────────────────
|
# ── RC: Create or update release-candidate release ──────────────
|
||||||
if [[ "$BRANCH" == rc/* ]]; then
|
if [[ "$BRANCH" == rc/* ]]; then
|
||||||
MAJOR=$(echo "$VERSION" | awk -F. '{print $1}')
|
RELEASE_TAG="release-candidate"
|
||||||
RELEASE_TAG="v${MAJOR}"
|
EXISTING=$(gh release view "$RELEASE_TAG" --json tagName -q .tagName 2>/dev/null || true)
|
||||||
DRAFT_EXISTS=$(gh release view "$RELEASE_TAG" --json isDraft -q .isDraft 2>/dev/null || true)
|
|
||||||
|
|
||||||
if [ -z "$DRAFT_EXISTS" ]; then
|
if [ -z "$EXISTING" ]; then
|
||||||
# No release exists — create draft
|
|
||||||
gh release create "$RELEASE_TAG" \
|
gh release create "$RELEASE_TAG" \
|
||||||
--title "v${MAJOR} (RC: ${VERSION})" \
|
--title "release-candidate (${VERSION})" \
|
||||||
--notes "## Release Candidate ${VERSION}\n\nRC branch: \`${BRANCH}\`\nTracking issue: ${PARENT_URL}" \
|
--notes "## Release Candidate ${VERSION}\n\nRC branch: \`${BRANCH}\`\nTracking issue: ${PARENT_URL}" \
|
||||||
--draft \
|
--prerelease \
|
||||||
--target main 2>/dev/null || true
|
--target main 2>/dev/null || true
|
||||||
echo "Draft release created: ${RELEASE_TAG}" >> $GITHUB_STEP_SUMMARY
|
echo "RC release created: ${RELEASE_TAG}" >> $GITHUB_STEP_SUMMARY
|
||||||
elif [ "$DRAFT_EXISTS" = "true" ]; then
|
|
||||||
# Draft exists — update title
|
|
||||||
gh release edit "$RELEASE_TAG" \
|
|
||||||
--title "v${MAJOR} (RC: ${VERSION})" --draft 2>/dev/null || true
|
|
||||||
echo "Draft release updated: ${RELEASE_TAG}" >> $GITHUB_STEP_SUMMARY
|
|
||||||
else
|
else
|
||||||
# Release exists and is published — set back to draft for RC
|
|
||||||
gh release edit "$RELEASE_TAG" \
|
gh release edit "$RELEASE_TAG" \
|
||||||
--title "v${MAJOR} (RC: ${VERSION})" --draft 2>/dev/null || true
|
--title "release-candidate (${VERSION})" --prerelease 2>/dev/null || true
|
||||||
echo "Release ${RELEASE_TAG} set to draft for RC" >> $GITHUB_STEP_SUMMARY
|
echo "RC release updated: ${RELEASE_TAG}" >> $GITHUB_STEP_SUMMARY
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
105
.github/workflows/auto-release.yml
vendored
105
.github/workflows/auto-release.yml
vendored
@@ -8,7 +8,7 @@
|
|||||||
# REPO: https://github.com/mokoconsulting-tech/MokoStandards
|
# REPO: https://github.com/mokoconsulting-tech/MokoStandards
|
||||||
# PATH: /templates/workflows/joomla/auto-release.yml.template
|
# PATH: /templates/workflows/joomla/auto-release.yml.template
|
||||||
# VERSION: 04.05.13
|
# 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) |
|
# | BUILD & RELEASE PIPELINE (JOOMLA) |
|
||||||
@@ -20,10 +20,10 @@
|
|||||||
# | 1. Read version from README.md |
|
# | 1. Read version from README.md |
|
||||||
# | 3. Set platform version (Joomla <version>) |
|
# | 3. Set platform version (Joomla <version>) |
|
||||||
# | 4. Update [VERSION: XX.YY.ZZ] badges in markdown files |
|
# | 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 |
|
# | 6. Create git tag vXX.YY.ZZ |
|
||||||
# | 7a. Patch: update existing GitHub Release for this minor |
|
# | 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 |
|
# | Every version change: archives main -> version/XX.YY branch |
|
||||||
# | Patch 00 = development (no release). First release = patch 01. |
|
# | Patch 00 = development (no release). First release = patch 01. |
|
||||||
@@ -39,6 +39,9 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- master
|
- master
|
||||||
|
paths:
|
||||||
|
- 'src/**'
|
||||||
|
- 'htdocs/**'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||||
@@ -66,7 +69,7 @@ jobs:
|
|||||||
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
|
||||||
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}'
|
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}'
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 --branch version/04.05 --quiet \
|
git clone --depth 1 --branch version/04 --quiet \
|
||||||
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
||||||
/tmp/mokostandards
|
/tmp/mokostandards
|
||||||
cd /tmp/mokostandards
|
cd /tmp/mokostandards
|
||||||
@@ -90,7 +93,7 @@ jobs:
|
|||||||
MINOR_NUM=$(echo "$VERSION" | awk -F. '{print $2}')
|
MINOR_NUM=$(echo "$VERSION" | awk -F. '{print $2}')
|
||||||
|
|
||||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||||
echo "branch=version/${MINOR}" >> "$GITHUB_OUTPUT"
|
echo "branch=version/${MAJOR}" >> "$GITHUB_OUTPUT"
|
||||||
echo "minor=$MINOR" >> "$GITHUB_OUTPUT"
|
echo "minor=$MINOR" >> "$GITHUB_OUTPUT"
|
||||||
echo "major=$MAJOR" >> "$GITHUB_OUTPUT"
|
echo "major=$MAJOR" >> "$GITHUB_OUTPUT"
|
||||||
echo "release_tag=v${MAJOR}" >> "$GITHUB_OUTPUT"
|
echo "release_tag=v${MAJOR}" >> "$GITHUB_OUTPUT"
|
||||||
@@ -256,8 +259,8 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# -- STEP 5: Write update.xml (Joomla update server) ---------------------
|
# -- STEP 5: Write updates.xml (Joomla update server) ---------------------
|
||||||
- name: "Step 5: Write update.xml"
|
- name: "Step 5: Write updates.xml"
|
||||||
if: >-
|
if: >-
|
||||||
steps.version.outputs.skip != 'true' &&
|
steps.version.outputs.skip != 'true' &&
|
||||||
steps.check.outputs.already_released != 'true'
|
steps.check.outputs.already_released != 'true'
|
||||||
@@ -268,7 +271,7 @@ jobs:
|
|||||||
# -- Parse extension metadata from XML manifest ----------------
|
# -- Parse extension metadata from XML manifest ----------------
|
||||||
MANIFEST=$(find . -maxdepth 2 -name "*.xml" -exec grep -l '<extension' {} \; 2>/dev/null | head -1)
|
MANIFEST=$(find . -maxdepth 2 -name "*.xml" -exec grep -l '<extension' {} \; 2>/dev/null | head -1)
|
||||||
if [ -z "$MANIFEST" ]; then
|
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
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -313,34 +316,60 @@ jobs:
|
|||||||
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/v${VERSION}/${EXT_ELEMENT}-${VERSION}.zip"
|
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/v${VERSION}/${EXT_ELEMENT}-${VERSION}.zip"
|
||||||
INFO_URL="https://github.com/${REPO}/releases/tag/v${VERSION}"
|
INFO_URL="https://github.com/${REPO}/releases/tag/v${VERSION}"
|
||||||
|
|
||||||
# -- Write update.xml (stable release) --------------------------
|
# -- Build stable entry ──────────────────────────────────────
|
||||||
|
STABLE_ENTRY=$(cat <<XMLEOF
|
||||||
|
<update>
|
||||||
|
<name>${EXT_NAME}</name>
|
||||||
|
<description>${EXT_NAME} update</description>
|
||||||
|
<element>${EXT_ELEMENT}</element>
|
||||||
|
<type>${EXT_TYPE}</type>
|
||||||
|
<version>${VERSION}</version>
|
||||||
|
$([ -n "$CLIENT_TAG" ] && echo " ${CLIENT_TAG}")
|
||||||
|
$([ -n "$FOLDER_TAG" ] && echo " ${FOLDER_TAG}")
|
||||||
|
<tags>
|
||||||
|
<tag>stable</tag>
|
||||||
|
</tags>
|
||||||
|
<infourl title="${EXT_NAME}">${INFO_URL}</infourl>
|
||||||
|
<downloads>
|
||||||
|
<downloadurl type="full" format="zip">${DOWNLOAD_URL}</downloadurl>
|
||||||
|
</downloads>
|
||||||
|
${TARGET_PLATFORM}
|
||||||
|
$([ -n "$PHP_TAG" ] && echo " ${PHP_TAG}")
|
||||||
|
<maintainer>Moko Consulting</maintainer>
|
||||||
|
<maintainerurl>https://mokoconsulting.tech</maintainerurl>
|
||||||
|
</update>
|
||||||
|
XMLEOF
|
||||||
|
)
|
||||||
|
|
||||||
|
# -- Write updates.xml preserving dev/rc entries ──────────────
|
||||||
|
# Extract existing dev and rc entries if present
|
||||||
|
RC_ENTRY=""
|
||||||
|
DEV_ENTRY=""
|
||||||
|
if [ -f "updates.xml" ]; then
|
||||||
|
RC_ENTRY=$(python3 -c "
|
||||||
|
import re
|
||||||
|
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)
|
||||||
|
DEV_ENTRY=$(python3 -c "
|
||||||
|
import re
|
||||||
|
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)
|
||||||
|
fi
|
||||||
|
|
||||||
{
|
{
|
||||||
printf '%s\n' '<?xml version="1.0" encoding="utf-8"?>'
|
printf '%s\n' '<?xml version="1.0" encoding="utf-8"?>'
|
||||||
printf '%s\n' '<updates>'
|
printf '%s\n' '<updates>'
|
||||||
printf '%s\n' ' <update>'
|
echo "$STABLE_ENTRY"
|
||||||
printf '%s\n' " <name>${EXT_NAME}</name>"
|
[ -n "$RC_ENTRY" ] && echo "$RC_ENTRY"
|
||||||
printf '%s\n' " <description>${EXT_NAME} update</description>"
|
[ -n "$DEV_ENTRY" ] && echo "$DEV_ENTRY"
|
||||||
printf '%s\n' " <element>${EXT_ELEMENT}</element>"
|
|
||||||
printf '%s\n' " <type>${EXT_TYPE}</type>"
|
|
||||||
printf '%s\n' " <version>${VERSION}</version>"
|
|
||||||
[ -n "$CLIENT_TAG" ] && printf '%s\n' " ${CLIENT_TAG}"
|
|
||||||
[ -n "$FOLDER_TAG" ] && printf '%s\n' " ${FOLDER_TAG}"
|
|
||||||
printf '%s\n' ' <tags>'
|
|
||||||
printf '%s\n' ' <tag>stable</tag>'
|
|
||||||
printf '%s\n' ' </tags>'
|
|
||||||
printf '%s\n' " <infourl title=\"${EXT_NAME}\">${INFO_URL}</infourl>"
|
|
||||||
printf '%s\n' ' <downloads>'
|
|
||||||
printf '%s\n' " <downloadurl type=\"full\" format=\"zip\">${DOWNLOAD_URL}</downloadurl>"
|
|
||||||
printf '%s\n' ' </downloads>'
|
|
||||||
printf '%s\n' " ${TARGET_PLATFORM}"
|
|
||||||
[ -n "$PHP_TAG" ] && printf '%s\n' " ${PHP_TAG}"
|
|
||||||
printf '%s\n' ' <maintainer>Moko Consulting</maintainer>'
|
|
||||||
printf '%s\n' ' <maintainerurl>https://mokoconsulting.tech</maintainerurl>'
|
|
||||||
printf '%s\n' ' </update>'
|
|
||||||
printf '%s\n' '</updates>'
|
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 + rc/dev preserved)" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
# -- Commit all changes ---------------------------------------------------
|
# -- Commit all changes ---------------------------------------------------
|
||||||
- name: Commit release changes
|
- name: Commit release changes
|
||||||
@@ -469,19 +498,19 @@ jobs:
|
|||||||
gh release upload "$RELEASE_TAG" "/tmp/${PACKAGE_NAME}" 2>/dev/null || true
|
gh release upload "$RELEASE_TAG" "/tmp/${PACKAGE_NAME}" 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
# -- Update update.xml with SHA-256 for latest patch -------------
|
# -- Update updates.xml with SHA-256 for latest patch -------------
|
||||||
if [ -f "update.xml" ]; then
|
if [ -f "updates.xml" ]; then
|
||||||
if grep -q '<sha256>' update.xml; then
|
if grep -q '<sha256>' updates.xml; then
|
||||||
sed -i "s|<sha256>.*</sha256>|<sha256>sha256:${SHA256}</sha256>|" update.xml
|
sed -i "s|<sha256>.*</sha256>|<sha256>sha256:${SHA256}</sha256>|" updates.xml
|
||||||
else
|
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
|
fi
|
||||||
|
|
||||||
# Also update the download URL to point to this patch's ZIP
|
# Also update the download URL to point to this patch's ZIP
|
||||||
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${RELEASE_TAG}/${PACKAGE_NAME}"
|
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]" \
|
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
|
--author="github-actions[bot] <github-actions[bot]@users.noreply.github.com>" || true
|
||||||
git push || true
|
git push || true
|
||||||
|
|||||||
8
.github/workflows/ci-joomla.yml
vendored
8
.github/workflows/ci-joomla.yml
vendored
@@ -57,7 +57,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 --branch version/04.05 --quiet \
|
git clone --depth 1 --branch version/04 --quiet \
|
||||||
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
||||||
/tmp/mokostandards
|
/tmp/mokostandards
|
||||||
|
|
||||||
@@ -312,11 +312,11 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check update.xml exists
|
# Check updates.xml exists
|
||||||
if [ -f "update.xml" ] || [ -f "updates.xml" ]; then
|
if [ -f "updates.xml" ] || [ -f "updates.xml" ]; then
|
||||||
echo "Update XML present." >> $GITHUB_STEP_SUMMARY
|
echo "Update XML present." >> $GITHUB_STEP_SUMMARY
|
||||||
else
|
else
|
||||||
echo "No update.xml found." >> $GITHUB_STEP_SUMMARY
|
echo "No updates.xml found." >> $GITHUB_STEP_SUMMARY
|
||||||
ERRORS=$((ERRORS + 1))
|
ERRORS=$((ERRORS + 1))
|
||||||
fi
|
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")
|
joomla_findings+=("No .ini language files found")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# update.xml must exist in root (Joomla update server)
|
# updates.xml must exist in root (Joomla update server)
|
||||||
if [ ! -f 'update.xml' ]; then
|
if [ ! -f 'updates.xml' ]; then
|
||||||
joomla_findings+=("update.xml missing in root (required for Joomla update server)")
|
joomla_findings+=("updates.xml missing in root (required for Joomla update server)")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# index.html files for directory listing protection
|
# index.html files for directory listing protection
|
||||||
|
|||||||
6
.github/workflows/standards-compliance.yml
vendored
6
.github/workflows/standards-compliance.yml
vendored
@@ -509,7 +509,7 @@ jobs:
|
|||||||
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
|
||||||
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}'
|
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}'
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 --branch version/04.05 --quiet \
|
git clone --depth 1 --branch version/04 --quiet \
|
||||||
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
||||||
/tmp/mokostandards 2>/dev/null || true
|
/tmp/mokostandards 2>/dev/null || true
|
||||||
if [ -d "/tmp/mokostandards" ] && [ -f "/tmp/mokostandards/composer.json" ]; then
|
if [ -d "/tmp/mokostandards" ] && [ -f "/tmp/mokostandards/composer.json" ]; then
|
||||||
@@ -1978,7 +1978,7 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "No composer.json — pulling MokoStandards tools"
|
echo "No composer.json — pulling MokoStandards tools"
|
||||||
if [ ! -d "/tmp/mokostandards" ]; then
|
if [ ! -d "/tmp/mokostandards" ]; then
|
||||||
git clone --depth 1 --branch version/04.05 --quiet \
|
git clone --depth 1 --branch version/04 --quiet \
|
||||||
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
||||||
/tmp/mokostandards 2>/dev/null || true
|
/tmp/mokostandards 2>/dev/null || true
|
||||||
if [ -f "/tmp/mokostandards/composer.json" ]; then
|
if [ -f "/tmp/mokostandards/composer.json" ]; then
|
||||||
@@ -2050,7 +2050,7 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "No composer.json — pulling MokoStandards tools"
|
echo "No composer.json — pulling MokoStandards tools"
|
||||||
if [ ! -d "/tmp/mokostandards" ]; then
|
if [ ! -d "/tmp/mokostandards" ]; then
|
||||||
git clone --depth 1 --branch version/04.05 --quiet \
|
git clone --depth 1 --branch version/04 --quiet \
|
||||||
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
||||||
/tmp/mokostandards 2>/dev/null || true
|
/tmp/mokostandards 2>/dev/null || true
|
||||||
if [ -f "/tmp/mokostandards/composer.json" ]; then
|
if [ -f "/tmp/mokostandards/composer.json" ]; then
|
||||||
|
|||||||
2
.github/workflows/sync-version-on-merge.yml
vendored
2
.github/workflows/sync-version-on-merge.yml
vendored
@@ -58,7 +58,7 @@ jobs:
|
|||||||
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
|
||||||
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}'
|
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}'
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 --branch version/04.05 --quiet \
|
git clone --depth 1 --branch version/04 --quiet \
|
||||||
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
||||||
/tmp/mokostandards
|
/tmp/mokostandards
|
||||||
cd /tmp/mokostandards
|
cd /tmp/mokostandards
|
||||||
|
|||||||
79
.github/workflows/update-server.yml
vendored
79
.github/workflows/update-server.yml
vendored
@@ -10,7 +10,7 @@
|
|||||||
# VERSION: 04.05.13
|
# VERSION: 04.05.13
|
||||||
# BRIEF: Update Joomla update server XML feed with stable/rc/dev entries
|
# 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>stable</tag> on push to main (from auto-release)
|
||||||
# - <tag>rc</tag> on push to rc/**
|
# - <tag>rc</tag> on push to rc/**
|
||||||
# - <tag>development</tag> on push to dev/**
|
# - <tag>development</tag> on push to dev/**
|
||||||
@@ -47,7 +47,7 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-xml:
|
update-xml:
|
||||||
name: Update update.xml
|
name: Update updates.xml
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -62,14 +62,14 @@ jobs:
|
|||||||
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
|
||||||
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}'
|
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}'
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 --branch version/04.05 --quiet \
|
git clone --depth 1 --branch version/04 --quiet \
|
||||||
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
|
||||||
/tmp/mokostandards 2>/dev/null || true
|
/tmp/mokostandards 2>/dev/null || true
|
||||||
if [ -d "/tmp/mokostandards" ] && [ -f "/tmp/mokostandards/composer.json" ]; then
|
if [ -d "/tmp/mokostandards" ] && [ -f "/tmp/mokostandards/composer.json" ]; then
|
||||||
cd /tmp/mokostandards && composer install --no-dev --no-interaction --quiet 2>/dev/null || true
|
cd /tmp/mokostandards && composer install --no-dev --no-interaction --quiet 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Generate update.xml entry
|
- name: Generate updates.xml entry
|
||||||
run: |
|
run: |
|
||||||
BRANCH="${{ github.ref_name }}"
|
BRANCH="${{ github.ref_name }}"
|
||||||
REPO="${{ github.repository }}"
|
REPO="${{ github.repository }}"
|
||||||
@@ -120,10 +120,42 @@ jobs:
|
|||||||
[ "$STABILITY" = "development" ] && DISPLAY_VERSION="${VERSION}-dev"
|
[ "$STABILITY" = "development" ] && DISPLAY_VERSION="${VERSION}-dev"
|
||||||
|
|
||||||
MAJOR=$(echo "$VERSION" | awk -F. '{print $1}')
|
MAJOR=$(echo "$VERSION" | awk -F. '{print $1}')
|
||||||
RELEASE_TAG="v${MAJOR}"
|
|
||||||
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${RELEASE_TAG}/${EXT_ELEMENT}-${VERSION}.zip"
|
# Each stability level has its own release tag
|
||||||
|
if [ "$STABILITY" = "rc" ]; then
|
||||||
|
RELEASE_TAG="release-candidate"
|
||||||
|
elif [ "$STABILITY" = "development" ]; then
|
||||||
|
RELEASE_TAG="development"
|
||||||
|
else
|
||||||
|
RELEASE_TAG="v${MAJOR}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PACKAGE_NAME="${EXT_ELEMENT}-${DISPLAY_VERSION}.zip"
|
||||||
|
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${RELEASE_TAG}/${PACKAGE_NAME}"
|
||||||
INFO_URL="https://github.com/${REPO}"
|
INFO_URL="https://github.com/${REPO}"
|
||||||
|
|
||||||
|
# ── Build install-ready ZIP ─────────────────────────────────
|
||||||
|
SOURCE_DIR="src"
|
||||||
|
[ ! -d "$SOURCE_DIR" ] && SOURCE_DIR="htdocs"
|
||||||
|
if [ -d "$SOURCE_DIR" ]; then
|
||||||
|
cd "$SOURCE_DIR"
|
||||||
|
zip -r "/tmp/${PACKAGE_NAME}" .
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
SHA256=$(sha256sum "/tmp/${PACKAGE_NAME}" | cut -d' ' -f1)
|
||||||
|
|
||||||
|
# Ensure draft release exists for this major
|
||||||
|
gh release view "$RELEASE_TAG" --json tagName > /dev/null 2>&1 || \
|
||||||
|
gh release create "$RELEASE_TAG" --title "${RELEASE_TAG} (${DISPLAY_VERSION})" --notes "${STABILITY} release" --prerelease --target main 2>/dev/null || true
|
||||||
|
|
||||||
|
# Upload ZIP to the major release
|
||||||
|
gh release upload "$RELEASE_TAG" "/tmp/${PACKAGE_NAME}" --clobber 2>/dev/null || true
|
||||||
|
|
||||||
|
echo "Package: ${PACKAGE_NAME} (SHA: ${SHA256})" >> $GITHUB_STEP_SUMMARY
|
||||||
|
else
|
||||||
|
SHA256=""
|
||||||
|
fi
|
||||||
|
|
||||||
# ── Build the new entry ───────────────────────────────────────
|
# ── Build the new entry ───────────────────────────────────────
|
||||||
NEW_ENTRY=$(cat <<XMLEOF
|
NEW_ENTRY=$(cat <<XMLEOF
|
||||||
<update>
|
<update>
|
||||||
@@ -141,6 +173,7 @@ jobs:
|
|||||||
<downloads>
|
<downloads>
|
||||||
<downloadurl type="full" format="zip">${DOWNLOAD_URL}</downloadurl>
|
<downloadurl type="full" format="zip">${DOWNLOAD_URL}</downloadurl>
|
||||||
</downloads>
|
</downloads>
|
||||||
|
$([ -n "$SHA256" ] && echo " <sha256>sha256:${SHA256}</sha256>")
|
||||||
${TARGET_PLATFORM}
|
${TARGET_PLATFORM}
|
||||||
$([ -n "$PHP_TAG" ] && echo " ${PHP_TAG}")
|
$([ -n "$PHP_TAG" ] && echo " ${PHP_TAG}")
|
||||||
<maintainer>Moko Consulting</maintainer>
|
<maintainer>Moko Consulting</maintainer>
|
||||||
@@ -149,20 +182,20 @@ jobs:
|
|||||||
XMLEOF
|
XMLEOF
|
||||||
)
|
)
|
||||||
|
|
||||||
# ── Merge into update.xml ─────────────────────────────────────
|
# ── Merge into updates.xml ─────────────────────────────────────
|
||||||
if [ ! -f "update.xml" ]; then
|
if [ ! -f "updates.xml" ]; then
|
||||||
# Create fresh
|
# Create fresh
|
||||||
printf '%s\n' '<?xml version="1.0" encoding="utf-8"?>' > update.xml
|
printf '%s\n' '<?xml version="1.0" encoding="utf-8"?>' > updates.xml
|
||||||
printf '%s\n' '<updates>' >> update.xml
|
printf '%s\n' '<updates>' >> updates.xml
|
||||||
echo "$NEW_ENTRY" >> update.xml
|
echo "$NEW_ENTRY" >> updates.xml
|
||||||
printf '%s\n' '</updates>' >> update.xml
|
printf '%s\n' '</updates>' >> updates.xml
|
||||||
else
|
else
|
||||||
# Remove existing entry for this stability, add new one
|
# Remove existing entry for this stability, add new one
|
||||||
# Use python for reliable XML manipulation
|
# Use python for reliable XML manipulation
|
||||||
python3 -c "
|
python3 -c "
|
||||||
import re, sys
|
import re, sys
|
||||||
|
|
||||||
with open('update.xml', 'r') as f:
|
with open('updates.xml', 'r') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
|
|
||||||
# Remove existing entry with this stability tag
|
# Remove existing entry with this stability tag
|
||||||
@@ -176,29 +209,29 @@ content = content.replace('</updates>', new_entry + '\n</updates>')
|
|||||||
# Clean up empty lines
|
# Clean up empty lines
|
||||||
content = re.sub(r'\n{3,}', '\n\n', content)
|
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)
|
f.write(content)
|
||||||
" 2>/dev/null || {
|
" 2>/dev/null || {
|
||||||
# Fallback: just rewrite the whole file if python fails
|
# Fallback: just rewrite the whole file if python fails
|
||||||
# Keep existing stable entry if present
|
# Keep existing stable entry if present
|
||||||
STABLE_ENTRY=""
|
STABLE_ENTRY=""
|
||||||
if [ "$STABILITY" != "stable" ] && grep -q '<tag>stable</tag>' update.xml; then
|
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 }' update.xml | sort -u)
|
STABLE_ENTRY=$(sed -n '/<update>/,/<\/update>/{ /<tag>stable<\/tag>/,/<\/update>/p; /<update>/,/<tag>stable<\/tag>/p }' updates.xml | sort -u)
|
||||||
fi
|
fi
|
||||||
RC_ENTRY=""
|
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 "
|
RC_ENTRY=$(python3 -c "
|
||||||
import re
|
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)
|
m = re.search(r'(<update>.*?<tag>rc</tag>.*?</update>)', c, re.DOTALL)
|
||||||
if m: print(m.group(1))
|
if m: print(m.group(1))
|
||||||
" 2>/dev/null || true)
|
" 2>/dev/null || true)
|
||||||
fi
|
fi
|
||||||
DEV_ENTRY=""
|
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 "
|
DEV_ENTRY=$(python3 -c "
|
||||||
import re
|
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)
|
m = re.search(r'(<update>.*?<tag>development</tag>.*?</update>)', c, re.DOTALL)
|
||||||
if m: print(m.group(1))
|
if m: print(m.group(1))
|
||||||
" 2>/dev/null || true)
|
" 2>/dev/null || true)
|
||||||
@@ -212,16 +245,16 @@ if m: print(m.group(1))
|
|||||||
[ -n "$DEV_ENTRY" ] && echo "$DEV_ENTRY"
|
[ -n "$DEV_ENTRY" ] && echo "$DEV_ENTRY"
|
||||||
echo "$NEW_ENTRY"
|
echo "$NEW_ENTRY"
|
||||||
printf '%s\n' '</updates>'
|
printf '%s\n' '</updates>'
|
||||||
} > update.xml
|
} > updates.xml
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Commit
|
# Commit
|
||||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git config --local user.name "github-actions[bot]"
|
git config --local user.name "github-actions[bot]"
|
||||||
git add update.xml
|
git add updates.xml
|
||||||
git diff --cached --quiet || {
|
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>"
|
--author="github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
|
||||||
git push
|
git push
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user