Ship an installable plugin zip instead of the source archive - #4
Merged
Merged
Conversation
GitHub's Download ZIP produces wordpress-plugin-main.zip, which unpacks to wordpress-plugin-main/ and carries the tests, CI config and Composer files with it. WordPress keys a plugin by its directory name, so that archive installs the plugin under the wrong slug. Build the release artifact with git archive --prefix=citecue/ instead, with development files marked export-ignore. Tracked files only, so nothing untracked can be swept into a release; the script also refuses to build on a version-string mismatch and asserts the archive's shape. CI runs it on every pull request, and a tag push publishes citecue.zip to the GitHub release. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
GitHub's Download ZIP button is a source archive, not an install path. It produces
wordpress-plugin-main.zip, which unpacks towordpress-plugin-main/and carriestests/,.github/and the Composer files with it. WordPress keys a plugin by its directory name — that name lands in the plugins list, in update checks and in every support thread — so anyone installing that way gets the plugin under the wrong slug plus a pile of development files.GitHub's archive name can't be changed, so the fix is to publish a real release artifact and point installs at it.
What changed
bin/build-plugin-zip.sh— buildsdist/citecue.zipwithgit archive --prefix=citecue/. Tracked files only, honouringexport-ignore, so an untrackedvendor/,.envor editor backup can never be swept into a release. It refuses to build whencitecue.php'sVersion:header,CITECUE_VERSIONandreadme.txt'sStable tag:disagree, and asserts the result has one correctly-named top-level directory with no development files and the three required entries present..gitattributes— a singleexport-ignorelist of what is developer-only..github/workflows/release.yml— avX.Y.Ztag push rebuilds the zip, fails if the tag disagrees with the plugin header, and attachescitecue.zipto the GitHub release.workflow_dispatchbuilds the artifact without publishing.packagejob inci.yml— runs the same script on every pull request, so packaging breaks in review rather than at release time.readme.txt— install steps now point at the release asset; a Releasing section documents the build and tag flow.The plugin has no runtime Composer dependencies (
requireis justphp >=7.4), so the shipped archive iscitecue.php,uninstall.php,includes/andreadme.txt— 15 files.Verification
Built and unpacked locally:
citecue/directorytests/, nocomposer.*, no CI configphp -lclean on every shipped fileNotes for the reviewer
git archivereads.gitattributesfrom the committed tree, so the build always reflects a commit, never the dirty working tree. The script warns when buildingHEADwith uncommitted changes.vX.Y.Ztag. The workflow rejects a tag that disagrees with the plugin header.ghCLI withcontents: write.🤖 Generated with Claude Code