Fix Windows release pipeline and add PHAR fallback for all platformsFeature/fix win release 4#149
Merged
jasdeepkhalsa merged 3 commits intomasterfrom Mar 7, 2026
Merged
Conversation
… upload All six Unix binaries share the basename 'dbdiff'. softprops/action-gh-release uploads by basename, so they all collide to a single asset. On re-runs the action queries existing assets, gets 6 records all named 'dbdiff', and tries to delete them by ID — but by the time it deletes #3-6 the prior ones are already gone, causing 'Error: Not Found' and aborting the step. Fix: add a rename step before the GH Release upload that moves each binary to include its platform: binaries/dbdiff-linux-x64/dbdiff → dbdiff-linux-x64 binaries/dbdiff-darwin-arm64/dbdiff → dbdiff-darwin-arm64 binaries/dbdiff-win32-x64/dbdiff.exe → dbdiff-win32-x64.exe binaries/dbdiff-phar/dbdiff.phar (untouched, already unique) Update the files glob to match the renamed assets: binaries/dbdiff-*/dbdiff-* binaries/dbdiff-phar/dbdiff.phar The rename step runs AFTER the npm copy step so npm packages still receive the original 'dbdiff'/'dbdiff.exe' names that bin/dbdiff.js expects.
On Windows (and any future unsupported platform) where no native static binary is available, bin/dbdiff.js now automatically falls back to running the bundled dbdiff.phar with system PHP instead of printing an error. Changes: - packages/@dbdiff/cli/package.json: add dbdiff.phar to 'files' so it ships with every npm install -g @dbdiff/cli - packages/@dbdiff/cli/bin/dbdiff.js: when getBinaryPath() returns null, check for dbdiff.phar alongside the script; if present, exec php/php.exe with the phar; clear error if php is not in PATH - release.yml: add 'Bundle PHAR into @dbdiff/cli' step that copies binaries/dbdiff-phar/dbdiff.phar into the package directory before npm publish (mirrors how Composer and WP-CLI ship on Windows via npm) Result: Windows users get a working 'dbdiff' command immediately after 'npm install -g @dbdiff/cli' as long as PHP 8.1+ is in their PATH — which is always true for the PHP developers this tool targets.
@dbdiff/cli-win32-arm64 was being skipped during npm publish because SPC doesn't support building a native Windows ARM64 binary. Now that @dbdiff/cli bundles dbdiff.phar and bin/dbdiff.js falls back to 'php dbdiff.phar' when no native binary is present, publishing the skeleton package is meaningful — npm installs it, bin/dbdiff.js finds it, sees no dbdiff.exe, and falls through to the PHAR fallback. Add PHAR_FALLBACK_PKGS list to the publish loop. Packages in that list are published even without a binary; all other packages without a binary are still skipped with a warning (indicating a build failure).
|
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.



Fix Windows release pipeline and add PHAR fallback for all platforms
Problem
Three issues were blocking a clean release:
GitHub Release upload failing with
Error: Not Found— all six Unix binaries share the filenamedbdiff.softprops/action-gh-releaseuploads by basename, so they collide to a single asset. On re-runs it tried to delete all six duplicates by ID, but by the 3rd–6th deletion the prior ones were already gone, causing a 404 that aborted the step. Previously uploaded assets were being silently deleted each re-run without replacement.Windows had no working binary — the SPC Windows build fails with 14 unresolved zlib linker symbols on x64, and SPC v2.8.2 hardcodes
phpsdk-vs17-x64.bat(which passesx64_amd64tovcvarsall.bat) making ARM64 builds impossible on ARM64 runners.@dbdiff/cli-win32-arm64was silently unpublished — the platform package skeleton existed but was being skipped during npm publish because it had no binary, leaving ARM64 Windows users with a failed install.Changes
release.ymldbdiff→dbdiff-linux-x64,dbdiff.exe→dbdiff-win32-x64.exe). Every release asset now has a unique name; re-runs delete and re-upload cleanly.@dbdiff/cli— copiesdbdiff.pharintopackages/@dbdiff/cli/before npm publish so it ships with everynpm install -g @dbdiff/cli.@dbdiff/cli-win32-arm64as a PHAR-fallback skeleton — adds aPHAR_FALLBACK_PKGSlist to the publish loop; packages in that list are published without a native binary rather than skipped.packages/@dbdiff/cli/package.jsondbdiff.pharto thefilesarray so it is included in the published npm package.packages/@dbdiff/cli/bin/dbdiff.jsgetBinaryPath()returnsnull(no native binary installed), fall back to running the bundleddbdiff.pharvia systemphp/php.exe.phpis not in PATH, print a clear actionable error: "Install PHP 8.1+ from https://www.php.net/downloads and add it to your PATH".Result
Windows users (
npm install -g @dbdiff/cli) get a workingdbdiffcommand immediately as long as PHP 8.1+ is in their PATH — which is expected for the PHP developers this tool targets. When native Windows static builds become possible (upstream SPC fix), they will automatically take priority over the fallback with no changes required.