diff --git a/.github/workflows/update-server.yml b/.github/workflows/update-server.yml index 4d4fc97..cc34448 100644 --- a/.github/workflows/update-server.yml +++ b/.github/workflows/update-server.yml @@ -121,9 +121,32 @@ jobs: 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" + 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}" + # ── 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 "v${MAJOR}" --notes "Development release" --draft --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 ─────────────────────────────────────── NEW_ENTRY=$(cat < @@ -141,6 +164,7 @@ jobs: ${DOWNLOAD_URL} + $([ -n "$SHA256" ] && echo " sha256:${SHA256}") ${TARGET_PLATFORM} $([ -n "$PHP_TAG" ] && echo " ${PHP_TAG}") Moko Consulting