From 10bdc2f5b0422e23b3a9fd9d6f1df84066054bc7 Mon Sep 17 00:00:00 2001 From: Daniel Alome Date: Wed, 12 Aug 2026 11:39:34 +0100 Subject: [PATCH] ADFA-5111 | Publish plugins automatically, replace hardcoded MAP in update-libs.yml --- .github/workflows/update-libs.yml | 59 ++++++++++++++++++++----------- scripts/update-libs.sh | 5 +-- 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/.github/workflows/update-libs.yml b/.github/workflows/update-libs.yml index cccd020d..95d5cee3 100644 --- a/.github/workflows/update-libs.yml +++ b/.github/workflows/update-libs.yml @@ -93,31 +93,48 @@ jobs: - name: Stage .cgp files with website filenames run: | mkdir -p deploy-staging - declare -A MAP=( - ["apk-viewer"]="apk-analyzer.cgp" - ["Beepy"]="beepy.cgp" - ["bookshelf"]="bookshelf.cgp" - ["keystore-generator"]="keystore-generator.cgp" - ["markdown-preview"]="markdown-previewer.cgp" - ["ndk-installer-plugin"]="ndk-installer.cgp" - ["random-xkcd"]="random-xkcd.cgp" - ["snippets"]="snippets.cgp" - ["icons-repository"]="icons-repository.cgp" - ["rainbow-on-the-go"]="rainbow-on-the-go.cgp" - ["ai-literacy-course"]="ai-literacy-course.cgp" - ["flutter-template"]="flutter-template.cgp" - ["get-ai-models"]="get-ai-models.cgp" - ["project-to-template"]="project-to-template.cgp" - ) - for module in "${!MAP[@]}"; do - src=$(ls "${module}/build/plugin/"*.cgp 2>/dev/null | head -n1) + + # Discover every plugin module the same way scripts/update-libs.sh does + # (a sibling dir whose build.gradle.kts applies the plugin-builder Gradle + # plugin) so new plugins deploy to the website automatically. The website + # filename is the lowercased module name with any trailing "-plugin" + # stripped; the case arms hold the legacy filenames the website already + # links that don't follow that rule — never change an existing name. + # Keep in sync with SKIP_PLUGINS in scripts/update-libs.sh. + SKIP_PLUGINS=(pebble-custom-function-template-installer) + + staged=0 + for build_file in */build.gradle.kts; do + [ -f "$build_file" ] || continue + grep -qF "com.itsaky.androidide.plugins.build" "$build_file" || continue + module="$(dirname "$build_file")" + skip=0 + for s in "${SKIP_PLUGINS[@]}"; do + [ "$s" = "$module" ] && skip=1 && break + done + if [ "$skip" -eq 1 ]; then + echo "Skipping $module (in SKIP_PLUGINS)" + continue + fi + case "$module" in + apk-viewer) name="apk-analyzer" ;; + markdown-preview) name="markdown-previewer" ;; + *) name="$(echo "${module%-plugin}" | tr '[:upper:]' '[:lower:]')" ;; + esac + src="$(ls "${module}/build/plugin/"*.cgp 2>/dev/null | grep -v -- '-debug\.cgp$' | head -n1)" if [ -z "$src" ]; then - echo "ERROR: no .cgp found under ${module}/build/plugin/" + echo "ERROR: no release .cgp found under ${module}/build/plugin/ (did assemblePlugin run?)" exit 1 fi - cp "$src" "deploy-staging/${MAP[$module]}" - echo "Staged $src -> deploy-staging/${MAP[$module]}" + cp "$src" "deploy-staging/${name}.cgp" + echo "Staged $src -> deploy-staging/${name}.cgp" + staged=$((staged + 1)) done + + if [ "$staged" -eq 0 ]; then + echo "ERROR: no plugin modules discovered under */build.gradle.kts" + exit 1 + fi ls -la deploy-staging/ - name: Upload .cgp artifacts for deploy job diff --git a/scripts/update-libs.sh b/scripts/update-libs.sh index 63e08bc7..c7760f61 100755 --- a/scripts/update-libs.sh +++ b/scripts/update-libs.sh @@ -119,8 +119,9 @@ echo "Updated libs/ from CodeOnTheGo@$CODEONTHEGO_SHA" printf " %-20s %s\n" "plugin-api.jar" "$(du -h "$LIBS_DIR/plugin-api.jar" | cut -f1)" printf " %-20s %s\n" "gradle-plugin.jar" "$(du -h "$LIBS_DIR/gradle-plugin.jar" | cut -f1)" -# Plugins listed here are skipped by both the build loop below and the -# staging loop in .github/workflows/build-plugins.yml. Keep the two in sync. +# Plugins listed here are skipped by the build loop below and the staging +# loops in .github/workflows/build-plugins.yml and +# .github/workflows/update-libs.yml. Keep the three in sync. SKIP_PLUGINS=(pebble-custom-function-template-installer) PLUGINS=()