Add plugin zip build task and CI release artifact
CI / Coding Standards (pull_request) Successful in 52s
CI / PHPStan (pull_request) Successful in 1m1s
CI / Tests (PHP 8.1) (pull_request) Successful in 52s
CI / Tests (PHP 8.2) (pull_request) Successful in 48s
CI / Tests (PHP 8.3) (pull_request) Successful in 47s
CI / No Debug Code (pull_request) Successful in 3s
CI / Build Plugin Zip (pull_request) Has been skipped

- bin/build-zip.sh + `composer build`: stage runtime files only, generate a
  production (no-dev) optimized autoloader, and emit
  dist/<slug>-<version>.zip with a single top-level plugin folder, ready to
  upload via wp-admin. Tests, tooling configs, docs, and dev dependencies
  are excluded; version is read from the plugin header.
- CI `build` job: on push to main (post-merge), after lint/static-analysis/
  test/no-debug pass, runs the build and uploads the zip via
  actions/upload-artifact.
- Ignore build/ and dist/.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 11:44:53 -03:00
parent 6397f08398
commit e9d6c189bc
4 changed files with 96 additions and 1 deletions
+32
View File
@@ -101,3 +101,35 @@ jobs:
echo "Debug code found in src/ — please remove before merging."
exit 1
fi
build:
name: Build Plugin Zip
runs-on: ubuntu-latest
# Only build a shippable artifact once changes land on main, and only
# after the quality gates pass.
needs: [lint, static-analysis, test, no-debug]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer:v2
- name: Build plugin zip
run: composer build
- name: Read plugin version
id: meta
run: |
version="$(sed -nE 's/^[[:space:]]*\*?[[:space:]]*Version:[[:space:]]*([^[:space:]]+).*/\1/p' unsupervised-schedular.php | head -1)"
echo "version=${version}" >> "$GITHUB_OUTPUT"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: unsupervised-schedular-${{ steps.meta.outputs.version }}
path: dist/*.zip
if-no-files-found: error