Skip to content

Attach plugin zip to GitHub Release via wp dist-archive - #290

Merged
Castellon-ACM merged 3 commits into
trunkfrom
ci/attach-release-zip
Sep 7, 2026
Merged

Attach plugin zip to GitHub Release via wp dist-archive#290
Castellon-ACM merged 3 commits into
trunkfrom
ci/attach-release-zip

Conversation

@davidperezgar

@davidperezgar davidperezgar commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • New workflow, triggered on release: published.
  • Builds JS/CSS (npm run build), installs production Composer deps, then uses wp-cli's dist-archive-command to build the zip honouring .distignore — same tool the manual release flow already uses.
  • Zip is named {name}-{version}.zip (e.g. frontblocks-1.5.2.zip) via --filename-format, and uploaded as an asset on the GitHub Release that triggered the run.
  • Existing releases (e.g. 1.5.2) currently have zero assets attached — this closes that gap going forward.

Notes

  • dist-archive-command pinned to ^3.0 (a tagged release, not dev-main): --filename-format only exists from v3.0 on, and it's silently ignored whenever a filename is passed instead of a directory — so the build step now targets a directory (./dist) with --create-target-dir.
  • Installing dist-archive-command unpinned resolves to dev-main, which requires wp-cli/wp-cli ^3.0 and fails against the current stable wp-cli.phar — verified locally against the exact phar this workflow downloads, hence the explicit ^3.0 tag pin.
  • --plugin-dirname isn't valid on this command version, so it's left out — the zip's top-level folder already comes out as frontblocks/ from the checkout directory name.

Test plan

  • Ran the full build + wp dist-archive --filename-format locally against this repo — produced frontblocks-1.5.3-beta.3.zip, top-level folder frontblocks/, 242 files, .distignore respected (no composer.json/lock, package.json, tests/, .github, AGENTS.md, vendor/ has only prod deps).
  • Publish a test release (or re-publish an existing one) to confirm the asset actually lands on a real GitHub Release.

🤖 Generated with Claude Code

Open WordPress Playground Preview

Builds the production zip with wp-cli's dist-archive-command (the same
tool used for manual releases, honouring .distignore) and uploads it as
an asset on the GitHub Release once published, so the plugin can be
installed straight from the Releases page.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

davidperezgar and others added 2 commits September 7, 2026 08:13
--filename-format is silently ignored when <target> names a file, so
switch to a directory target with --create-target-dir. Also bumps
dist-archive-command to ^3.0 (a tagged release), the minimum version
that supports --filename-format.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The PR's own test plan flagged this as unverified: nothing exercises
the workflow end to end without publishing a real release. A manual
tag_name input lets it be re-run against an already-published release
(re-checking out that tag) to confirm the zip actually gets attached.

Also drops the now-redundant mkdir -p dist: --create-target-dir already
creates the target directory.
@Castellon-ACM
Castellon-ACM merged commit 04c1b3d into trunk Sep 7, 2026
1 check passed
@Castellon-ACM
Castellon-ACM deleted the ci/attach-release-zip branch September 7, 2026 07:03
Castellon-ACM added a commit that referenced this pull request Sep 7, 2026
)

The workflow #290 merged failed end to end when actually run — verified
live against the real 1.5.2 release via the new workflow_dispatch
trigger this commit adds.

- Real bug (fatal): wp package install failed every time with "Your
  github oauth token for github.com contains invalid characters".
  shivammathur/setup-php writes a github-oauth token into Composer's
  global auth.json (to dodge GitHub API rate limits during its own
  setup) that this Composer version's own validation rejects as
  malformed. Fixed by unsetting that config entry before installing
  dist-archive-command — a public package, no auth needed.
- Real bug (packaging): the produced zip contained an empty
  frontblocks/dist/ folder. wp dist-archive's own --create-target-dir
  output (./dist) lived inside the plugin directory being archived, and
  .distignore has no entry for it, so it got swept into the zip. Fixed
  by building into runner.temp instead, entirely outside the checkout.
- Adds workflow_dispatch with a tag_name input so this can be tested
  against an already-published release without cutting a new one —
  this is how both bugs above were actually found and fixed.

Verified: downloaded frontblocks-1.5.2.zip after a successful run — 231
files, single top-level frontblocks/ folder, no dist/ entry, no
composer.json/package.json/node_modules/tests/.github.
@Castellon-ACM

Copy link
Copy Markdown
Contributor

Follow-up: this shipped broken — verified live and fixed in #292 (tracked in #293). Two real bugs: the wp package install step failed every run due to a bad Composer auth token setup-php injects, and the produced zip packaged an empty dist/ folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants