bc4fad3b86
Anti-EAV Lint + Quality Gate / anti-eav-lint (push) Successful in 10s
Tests / Unit Tests (push) Successful in 13s
Tests / Integration Tests (push) Successful in 35s
Tests / PHP Lint (push) Successful in 9s
Tests / PHPCS (push) Successful in 24s
Tests / PHPStan (push) Successful in 26s
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY
82 lines
2.8 KiB
Bash
82 lines
2.8 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
|
|
# 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
|
|
|
|
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"
|