77b4501682
.gitea/workflows/ - test.yml:unit / integration / lint / phpcs,外加 A 從未有過的 phpstan job。 env 改 TMDO_TEST_DB_*(bootstrap 仍相容 WPDO_TEST_DB_*),host-mode runner 直連本機 MariaDB,保留 A v3.4.6 的 DB preflight(區分 INFRA 失敗與測試失敗) - anti-eav-lint.yml:TMDO_HOST 指向 dev30、改用 wp tmdo lint、slug 換成 2meet-data-optimizer - release.yml:v* tag 觸發,test-gate 加跑 phpstan scripts/ci-package.sh 依專案規範委派給共用的 scripts/package-plugin.sh(10 項終檢、統一排除清單、 輸出 wp-local-dev/dist/),而不是自帶一份排除邏輯;找不到共用腳本時才走 最小 fallback 並明確警告該路徑跳過終檢。 實測:bash scripts/ci-package.sh → 10 項終檢全 PASS (552 KB / 185 entries、schema drift 34 CREATE vs 34 DROP 對齊) 註:B 目前沒有 git remote,workflow 檔案就緒但要推上 gitea 才會實際執行。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY
71 lines
2.3 KiB
Bash
71 lines
2.3 KiB
Bash
#!/usr/bin/env bash
|
|
# CI packaging entry point for 2meet-data-optimizer.
|
|
#
|
|
# The project mandates that every custom plugin ZIP is produced by the shared
|
|
# scripts/package-plugin.sh (10 mandatory release checks, unified exclude list,
|
|
# output under wp-local-dev/dist/). This wrapper therefore delegates instead of
|
|
# maintaining a second copy of that logic, and only falls back to a minimal
|
|
# self-contained build when the shared script is unreachable (e.g. a runner
|
|
# without the wp-local-dev tree mounted).
|
|
#
|
|
# Usage: bash scripts/ci-package.sh
|
|
set -euo pipefail
|
|
|
|
SLUG="2meet-data-optimizer"
|
|
VERSION=$(grep -m1 "Version:" "${SLUG}.php" | sed "s/.*Version:[[:space:]]*//" | tr -d '[:space:]')
|
|
SHARED="/var/www/Studio/wp-local-dev/scripts/package-plugin.sh"
|
|
SHARED_DIST="/var/www/Studio/wp-local-dev/dist"
|
|
|
|
echo "=== Packaging ${SLUG} v${VERSION} ==="
|
|
|
|
if [ -f "${SHARED}" ]; then
|
|
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"
|
|
echo "=== Done: dist/${SLUG}-v${VERSION}.zip (via shared package-plugin.sh) ==="
|
|
exit 0
|
|
fi
|
|
|
|
echo "!! Shared package-plugin.sh not found — falling back to a minimal build."
|
|
echo "!! This path SKIPS the 10 release checks; do not use it for real releases."
|
|
|
|
if [ -f composer.json ]; then
|
|
composer install --no-dev --optimize-autoloader --quiet
|
|
fi
|
|
|
|
mkdir -p dist
|
|
TMPDIR=$(mktemp -d)
|
|
trap 'rm -rf "${TMPDIR}"' EXIT
|
|
|
|
rsync -a \
|
|
--exclude='.git' \
|
|
--exclude='.gitea' \
|
|
--exclude='.github' \
|
|
--exclude='.vscode' \
|
|
--exclude='.idea' \
|
|
--exclude='.claude' \
|
|
--exclude='.phpstan' \
|
|
--exclude='tests' \
|
|
--exclude='docs' \
|
|
--exclude='e2e' \
|
|
--exclude='node_modules' \
|
|
--exclude='dist' \
|
|
--exclude='scripts' \
|
|
--exclude='phpunit*.xml' \
|
|
--exclude='phpcs.xml' \
|
|
--exclude='phpstan*.neon' \
|
|
--exclude='composer.lock' \
|
|
--exclude='.phpunit.result.cache' \
|
|
--exclude='PLAN.md' \
|
|
--exclude='CLAUDE.md' \
|
|
--exclude='DEPLOY.md' \
|
|
./ "${TMPDIR}/${SLUG}/"
|
|
|
|
( cd "${TMPDIR}" && zip -qr "${SLUG}-v${VERSION}.zip" "${SLUG}" )
|
|
mv "${TMPDIR}/${SLUG}-v${VERSION}.zip" "dist/"
|
|
|
|
echo "=== Done: dist/${SLUG}-v${VERSION}.zip (fallback build) ==="
|
|
md5sum "dist/${SLUG}-v${VERSION}.zip"
|