[PR #149] [MERGED] Fix Windows release pipeline and add PHAR fallback for all platformsFeature/fix win release 4 #280

Closed
opened 2026-03-07 20:42:41 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/DBDiff/DBDiff/pull/149
Author: @jasdeepkhalsa
Created: 3/7/2026
Status: Merged
Merged: 3/7/2026
Merged by: @jasdeepkhalsa

Base: masterHead: feature/fix-win-release-4


📝 Commits (3)

  • f12ef8e fix: rename binaries to platform-specific names before GitHub Release upload
  • 8408a17 feat: PHAR fallback in @dbdiff/cli for platforms without a native binary
  • 12c666d feat: publish win32-arm64 as PHAR-fallback skeleton package

📊 Changes

3 files changed (+76 additions, -20 deletions)

View changed files

📝 .github/workflows/release.yml (+39 -9)
📝 packages/@dbdiff/cli/bin/dbdiff.js (+36 -11)
📝 packages/@dbdiff/cli/package.json (+1 -0)

📄 Description

Fix Windows release pipeline and add PHAR fallback for all platforms

Problem

Three issues were blocking a clean release:

  1. GitHub Release upload failing with Error: Not Found — all six Unix binaries share the filename dbdiff. softprops/action-gh-release uploads 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.

  2. 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 passes x64_amd64 to vcvarsall.bat) making ARM64 builds impossible on ARM64 runners.

  3. @dbdiff/cli-win32-arm64 was 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.yml

  • Rename binaries before GitHub Release upload — adds a step after npm publish that renames each binary to include its platform (e.g. dbdiffdbdiff-linux-x64, dbdiff.exedbdiff-win32-x64.exe). Every release asset now has a unique name; re-runs delete and re-upload cleanly.
  • Bundle PHAR into @dbdiff/cli — copies dbdiff.phar into packages/@dbdiff/cli/ before npm publish so it ships with every npm install -g @dbdiff/cli.
  • Publish @dbdiff/cli-win32-arm64 as a PHAR-fallback skeleton — adds a PHAR_FALLBACK_PKGS list to the publish loop; packages in that list are published without a native binary rather than skipped.

packages/@dbdiff/cli/package.json

  • Add dbdiff.phar to the files array so it is included in the published npm package.

packages/@dbdiff/cli/bin/dbdiff.js

  • When getBinaryPath() returns null (no native binary installed), fall back to running the bundled dbdiff.phar via system php/php.exe.
  • If php is 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

Platform Before After
Linux x64/arm64 + musl native binary native binary
macOS x64/arm64 native binary native binary
Windows x64 no binary, unhelpful error PHP PHAR fallback
Windows ARM64 package not published PHP PHAR fallback
GitHub Release assets 404 on re-run unique names, idempotent

Windows users (npm install -g @dbdiff/cli) get a working dbdiff command 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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/DBDiff/DBDiff/pull/149 **Author:** [@jasdeepkhalsa](https://github.com/jasdeepkhalsa) **Created:** 3/7/2026 **Status:** ✅ Merged **Merged:** 3/7/2026 **Merged by:** [@jasdeepkhalsa](https://github.com/jasdeepkhalsa) **Base:** `master` ← **Head:** `feature/fix-win-release-4` --- ### 📝 Commits (3) - [`f12ef8e`](https://github.com/DBDiff/DBDiff/commit/f12ef8e54bac2d1e0b7d2aa478feebfa3e7d8c7e) fix: rename binaries to platform-specific names before GitHub Release upload - [`8408a17`](https://github.com/DBDiff/DBDiff/commit/8408a17a409a81c1ebeba21dafb91e75837ad7d0) feat: PHAR fallback in @dbdiff/cli for platforms without a native binary - [`12c666d`](https://github.com/DBDiff/DBDiff/commit/12c666d31ce5db29e633647f6484489ef61be0e6) feat: publish win32-arm64 as PHAR-fallback skeleton package ### 📊 Changes **3 files changed** (+76 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/release.yml` (+39 -9) 📝 `packages/@dbdiff/cli/bin/dbdiff.js` (+36 -11) 📝 `packages/@dbdiff/cli/package.json` (+1 -0) </details> ### 📄 Description ## Fix Windows release pipeline and add PHAR fallback for all platforms ### Problem Three issues were blocking a clean release: 1. **GitHub Release upload failing with `Error: Not Found`** — all six Unix binaries share the filename `dbdiff`. `softprops/action-gh-release` uploads 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. 2. **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 passes `x64_amd64` to `vcvarsall.bat`) making ARM64 builds impossible on ARM64 runners. 3. **`@dbdiff/cli-win32-arm64` was 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.yml` - **Rename binaries before GitHub Release upload** — adds a step after npm publish that renames each binary to include its platform (e.g. `dbdiff` → `dbdiff-linux-x64`, `dbdiff.exe` → `dbdiff-win32-x64.exe`). Every release asset now has a unique name; re-runs delete and re-upload cleanly. - **Bundle PHAR into `@dbdiff/cli`** — copies `dbdiff.phar` into `packages/@dbdiff/cli/` before npm publish so it ships with every `npm install -g @dbdiff/cli`. - **Publish `@dbdiff/cli-win32-arm64` as a PHAR-fallback skeleton** — adds a `PHAR_FALLBACK_PKGS` list to the publish loop; packages in that list are published without a native binary rather than skipped. #### `packages/@dbdiff/cli/package.json` - Add `dbdiff.phar` to the `files` array so it is included in the published npm package. #### `packages/@dbdiff/cli/bin/dbdiff.js` - When `getBinaryPath()` returns `null` (no native binary installed), fall back to running the bundled `dbdiff.phar` via system `php`/`php.exe`. - If `php` is 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 | Platform | Before | After | |---|---|---| | Linux x64/arm64 + musl | ✅ native binary | ✅ native binary | | macOS x64/arm64 | ✅ native binary | ✅ native binary | | Windows x64 | ❌ no binary, unhelpful error | ✅ PHP PHAR fallback | | Windows ARM64 | ❌ package not published | ✅ PHP PHAR fallback | | GitHub Release assets | ❌ 404 on re-run | ✅ unique names, idempotent | Windows users (`npm install -g @dbdiff/cli`) get a working `dbdiff` command 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-07 20:42:41 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/DBDiff#280
No description provided.