From a5ae616a94e72b28e2ddd27ac0daf65f42ef826e Mon Sep 17 00:00:00 2001 From: "gitea-actions[bot]" Date: Mon, 25 May 2026 21:59:33 -0500 Subject: [PATCH] fix(ci): auto-release preserves all update channels [skip ci] --- .mokogitea/workflows/auto-release.yml | 29 +++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.mokogitea/workflows/auto-release.yml b/.mokogitea/workflows/auto-release.yml index 2201100..8bf9962 100644 --- a/.mokogitea/workflows/auto-release.yml +++ b/.mokogitea/workflows/auto-release.yml @@ -26,7 +26,8 @@ name: "Universal: Build & Release" on: - push: + pull_request: + types: [closed] branches: - main paths: @@ -47,7 +48,8 @@ jobs: release: name: Build & Release Pipeline runs-on: release - if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' + if: >- + github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' steps: - name: Checkout repository @@ -94,9 +96,9 @@ jobs: fi MAJOR=$(echo "$VERSION" | cut -d. -f1) echo "version=${VERSION}" >> "$GITHUB_OUTPUT" - echo "release_tag=v${MAJOR}" >> "$GITHUB_OUTPUT" + echo "release_tag=stable" >> "$GITHUB_OUTPUT" echo "skip=false" >> "$GITHUB_OUTPUT" - echo "branch=version/${MAJOR}" >> "$GITHUB_OUTPUT" + echo "branch=main" >> "$GITHUB_OUTPUT" - name: "Step 1b: Bump version" id: bump @@ -268,6 +270,15 @@ jobs: steps.platform.outputs.platform == 'joomla' run: | VERSION="${{ steps.bump.outputs.version || steps.version.outputs.version }}" + + # Fetch latest updates.xml from main so preserve logic has all channels + GA_TOKEN="${{ secrets.GA_TOKEN }}" + API="${GITEA_URL}/api/v1/repos/${{ github.repository }}" + curl -sf -H "Authorization: token ${GA_TOKEN}" \ + "${API}/contents/updates.xml?ref=main" 2>/dev/null | \ + python3 -c "import sys,json,base64; print(base64.b64decode(json.load(sys.stdin)['content']).decode())" \ + > updates.xml 2>/dev/null || true + php /tmp/moko-platform-api/cli/updates_xml_build.php \ --path . --version "${VERSION}" --stability stable \ --gitea-url "${GITEA_URL}" --org "${GITEA_ORG}" --repo "${GITEA_REPO}" \ @@ -337,6 +348,8 @@ jobs: [ -z "$NOTES" ] && NOTES="Release ${VERSION}" # Build release name: "Pretty Name VERSION (type_element-VERSION)" + # Strip existing type prefix to prevent duplication + EXT_ELEMENT=$(echo "$EXT_ELEMENT" | sed -E 's/^(pkg_|com_|mod_|plg_[a-z]+_|tpl_|lib_)//') TYPE_PREFIX="" case "${EXT_TYPE}" in plugin) TYPE_PREFIX="plg_${EXT_FOLDER}_" ;; @@ -407,6 +420,13 @@ jobs: # ZIP name: type_folder_element-VERSION (e.g. plg_system_mokojgdpc-01.01.00.zip) EXT_TYPE=$(sed -n 's/.*]*type="\([^"]*\)".*/\1/p' "$MANIFEST" | head -1) EXT_FOLDER=$(sed -n 's/.*]*group="\([^"]*\)".*/\1/p' "$MANIFEST" | head -1) + # For packages, prefer over filename-derived element + if [ "$EXT_TYPE" = "package" ]; then + PKG_NAME=$(sed -n 's/.*\([^<]*\)<\/packagename>.*/\1/p' "$MANIFEST" 2>/dev/null | head -1) + [ -n "$PKG_NAME" ] && EXT_ELEMENT="$PKG_NAME" + fi + # Strip existing type prefix to prevent duplication (e.g. pkg_mokowaas → mokowaas) + EXT_ELEMENT=$(echo "$EXT_ELEMENT" | sed -E 's/^(pkg_|com_|mod_|plg_[a-z]+_|tpl_|lib_)//') TYPE_PREFIX="" case "${EXT_TYPE}" in plugin) TYPE_PREFIX="plg_${EXT_FOLDER}_" ;; @@ -568,6 +588,7 @@ jobs: EXT_FOLDER="${{ steps.updates.outputs.ext_folder }}" # Build TYPE_PREFIX to match Step 8's ZIP naming + EXT_ELEMENT=$(echo "$EXT_ELEMENT" | sed -E 's/^(pkg_|com_|mod_|plg_[a-z]+_|tpl_|lib_)//') TYPE_PREFIX="" case "${EXT_TYPE}" in plugin) TYPE_PREFIX="plg_${EXT_FOLDER}_" ;;