From bc4fad3b8662383fd43cf699de74eb8583ab5b9c Mon Sep 17 00:00:00 2001 From: wpdev Date: Fri, 31 Jul 2026 09:31:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20packaging=20=E6=AD=A5=E9=A9=9F?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E5=9C=A8=E6=AF=8F=E6=AC=A1=20push=20?= =?UTF-8?q?=E5=9F=B7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit package-plugin.sh 依 SLUG 解析到 wp-content/plugins 下的固定路徑,打包的是 線上工作副本而非 CI 的 checkout,且會在該目錄跑 composer install --no-dev → 每次 push 都會把開發機的 vendor/bin 清掉(本 session 中發生兩次)。 - anti-eav-lint.yml:移除 packaging 步驟,只保留 lint - ci-package.sh:委派共用腳本後補跑 composer install 還原 dev 依賴 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY --- .gitea/workflows/anti-eav-lint.yml | 17 ++++++----------- scripts/ci-package.sh | 11 +++++++++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/anti-eav-lint.yml b/.gitea/workflows/anti-eav-lint.yml index da30dd9..ed65e0f 100644 --- a/.gitea/workflows/anti-eav-lint.yml +++ b/.gitea/workflows/anti-eav-lint.yml @@ -53,14 +53,9 @@ jobs: echo "TMDO_HOST not found; skipping anti-eav lint" fi - - name: Packaging audit (10-check) - run: | - # package-plugin.sh lives in the wp-local-dev tree and is shared by all - # custom plugins; its output goes to wp-local-dev/dist/. - PACKAGING_HOST="/var/www/Studio/wp-local-dev" - if [ -d "$PACKAGING_HOST" ]; then - SLUG="2meet-data-optimizer" - bash "$PACKAGING_HOST/scripts/package-plugin.sh" "$SLUG" - else - echo "PACKAGING_HOST not found; skipping packaging audit" - fi + # NOTE: no packaging audit here on purpose. + # The shared package-plugin.sh resolves the plugin by SLUG to a fixed path + # under wp-content/plugins — it does NOT package the CI checkout. Running it + # from a job therefore rebuilds (and `composer install --no-dev`s) the live + # working copy, wiping the developer's vendor/bin. Packaging belongs to the + # release workflow / a manual run, not to every push. diff --git a/scripts/ci-package.sh b/scripts/ci-package.sh index 281a14b..93c66a3 100644 --- a/scripts/ci-package.sh +++ b/scripts/ci-package.sh @@ -19,11 +19,22 @@ SHARED_DIST="/var/www/Studio/wp-local-dev/dist" echo "=== Packaging ${SLUG} v${VERSION} ===" if [ -f "${SHARED}" ]; then + # WARNING: package-plugin.sh resolves the plugin by SLUG to its fixed path + # under wp-content/plugins — it packages the live working copy, not this + # checkout, and runs `composer install --no-dev` there. Restore the dev + # dependencies afterwards so a developer's vendor/bin survives. bash "${SHARED}" "${SLUG}" + # Surface the artefact under ./dist too so the release job's `ls dist/*.zip` # works regardless of which path produced it. mkdir -p dist cp "${SHARED_DIST}/${SLUG}-v${VERSION}.zip" "dist/${SLUG}-v${VERSION}.zip" + + if [ -f composer.json ]; then + echo "--- Restoring dev dependencies (package-plugin.sh ran --no-dev) ---" + composer install --no-interaction --quiet + fi + echo "=== Done: dist/${SLUG}-v${VERSION}.zip (via shared package-plugin.sh) ===" exit 0 fi