Multi-Platform Binary Distributions (Windows, Mac, Linux, npm) & Box PHAR Builds#143
Merged
jasdeepkhalsa merged 3 commits intomasterfrom Mar 7, 2026
Merged
Conversation
Add full distribution pipeline: Box-compiled PHAR → static PHP micro SAPI
binary (via static-php-cli) → npm packages per platform → GitHub Release assets.
PHAR build
- Add box.json (humbug/box config): GZ compression, check-requirements disabled
so the micro SAPI binary passes Box's PHP_SAPI guard
- Add humbug/box ^3.0 as a dev dependency (v3 required by platform.php: 8.0)
- Remove scripts/build — the old hand-rolled Phar::buildFromDirectory script,
superseded entirely by box.json + vendor/bin/box compile
npm packages
- Add packages/@dbdiff/cli/ — root shim package (bin/dbdiff.js)
- musl detection via /proc/version + ldd fallback
- resolves the correct platform binary via require.resolve at runtime
- 8 optionalDependencies covering all supported platforms
- Add packages/@dbdiff/cli-{linux,darwin,win32}-{x64,arm64}[-musl]/
- Correct os/cpu/libc fields for npm's conditional install
- linux musl variants declare libc: ["musl"]
Static binary pipeline (static-php-cli / SPC)
- Extensions: phar,pdo_mysql,pdo_pgsql,pdo_sqlite,openssl,zlib,mbstring,
dom,libxml,tokenizer,ctype,json,iconv
- Libraries: libiconv,libxml2,ncurses,libedit,postgresql,sqlite
- Build mode: --build-micro → buildroot/bin/micro.sfx (stitch: cat micro.sfx phar)
- SPC produces a musl-linked static binary on Linux regardless of host libc,
so linux-x64 and linux-x64-musl ship the same binary
Scripts
- Add scripts/release-binaries.sh — local Podman-based builder for all 4 Linux
targets; arm64 via --platform linux/arm64 (QEMU); musl variants are copies
- Add scripts/test-release-podman.sh — distro smoke-test suite (9 images:
Ubuntu 20/22/24, Debian 11/12, AlmaLinux 9, Alpine 3.19/3.20/3.21)
- Add scripts/update-homebrew-formula.sh — downloads release assets, computes
SHA256, stamps version + hashes into homebrew-dbdiff/Formula/dbdiff.rb
- Update scripts/release.sh — aligned to new Box-based PHAR build and updated
post-release instructions referencing the GA workflow
- Remove scripts/spc-build-alpine.sh — unused reference script (superseded by
the inline SPC steps in release-binaries.sh and release.yml)
GitHub Actions (.github/workflows/release.yml)
- Fully rewritten workflow: build-phar → build-binary (8-target matrix) → publish
- Binary matrix: native ubuntu runners for linux x64/arm64; macOS runners for
darwin; Windows runners for win32; musl copies via Alpine container
- Publish job: stamps version into all package.json files, copies binaries,
publishes to npm with provenance, creates/updates GitHub Release
- Idempotent for re-runs against an already-tagged release:
- git tag step skipped if tag already exists on origin
- npm publish steps check registry before publishing (skip if present)
- softprops/action-gh-release updates release in-place (make_latest: true)
.gitignore
- Ignore built artefacts: dist/, packages/@dbdiff/*/dbdiff,
packages/@dbdiff/*/dbdiff.exe, packages/@dbdiff/*/node_modules/
…ME overhaul Distribution - Add docker/Dockerfile.slim: PHP 8.3 Alpine + PHAR, ~119 MB, locally tested - Add publish-docker GHA job: pushes slim + full images to Docker Hub and GHCR on every release; each login/push step is independent (continue-on-error) so a missing Docker Hub secret never blocks GHCR, with an always-runs summary step - Fix .dockerignore: add exception for dist/dbdiff.phar so Dockerfile.slim can COPY it PHP minimum floor -> 8.1 - composer.json: require.php and config.platform.php bumped from 8.0 to 8.1 - composer.lock: regenerated content-hash for 8.1 platform override - .github/workflows/tests.yml: PHP matrix minimum 8.0 -> 8.1 Config file unification - src/Params/FSGetter.php: auto-detect chain .dbdiff -> dbdiff.yml -> .dbdiff.yml -> dbdiff.yaml (backwards-compatible; legacy .dbdiff still works) - dbdiff.yml.example: restructured so diff section (server1/server2/driver/type) is first-class and uncommented; migration section follows; single file covers both modes README - Full rewrite: new Installation table with "Available on Releases?" column, PHP requirement callout (8.1 for PHAR/Composer; bundled 8.3 for binaries/Docker/npm), unified dbdiff.yml File Examples with config priority table, Docker registry pull commands and image variant table, Supabase link in Features
Changes: - release.yml: remove Docker Hub login + push steps; GHCR-only publish - release.yml: simplify login report and summary steps - README.md: Docker section updated to GHCR-only pull commands and variant table
|
This was referenced Apr 2, 2026
Closed
Closed
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.



feat: Multi-platform binary distribution + GHCR registry publishing + v3.0.0 prep
Overview
This PR ships DBDiff as a proper multi-platform CLI tool — pre-built self-contained binaries for 8 platforms, npm packages, GHCR registry images, a Homebrew formula updater, and a unified config file. It also raises the PHP floor to 8.1 and completely rewrites the README.
Distribution — new installation methods
Pre-built binaries (zero dependencies)
PHAR builds now with Box and static self-contained executables built with static-php-cli — PHP 8.3 micro SAPI + PHAR stitched together. No PHP, Composer, or Node required.
dbdiff-linux-x64dbdiff-linux-x64-musldbdiff-linux-arm64dbdiff-linux-arm64-musldbdiff-darwin-x64dbdiff-darwin-arm64dbdiff-win32-x64.exedbdiff-win32-arm64.exenpm —
@dbdiff/climeta-package with 8 optional platform packages. Installs the correct binary automatically.Docker — new
docker/Dockerfile.slim(PHP 8.3 Alpine + PHAR, ~119 MB). Published to GHCR on every release — no secrets required beyond the defaultGITHUB_TOKEN.docker pull ghcr.io/dbdiff/dbdiff:latest # GHCR (free, no secrets needed) docker run --rm ghcr.io/dbdiff/dbdiff:latest --helpGitHub Actions
release.yml— new complete release pipeline triggered onv*tag push:build-phar— compilesdist/dbdiff.pharvia Box, uploads as artifactbuild-binary— matrix across 8 platform targets; SPC downloads sources, buildsmicro.sfx, stitches with PHARpublish— creates GitHub Release, uploads all binaries + PHAR, publishes npm packagespublish-docker— pushes slim + full images to GHCR; login and push steps havecontinue-on-error: truewith anif: always()summary step showing ✅/⏭️/❌; multi-arch build (linux/amd64+linux/arm64) via QEMU + buildx; GHA layer cachingtests.yml— PHP matrix minimum bumped8.0→8.1PHP 8.0 dropped — minimum now 8.1
composer.json:require.phpandconfig.platform.phpbumped from8.0to8.1composer.lock: regenerated content-hash for 8.1 platform overridehumbug/boxbuild-time conflict that was failing CIUnified config file (
dbdiff.yml)Previously the diff tool only looked for
.dbdiffand the migration runner only looked fordbdiff.yml. NowFSGetter.phpwalks a fallback chain so one file drives both modes:.dbdiff→dbdiff.yml→.dbdiff.yml→dbdiff.yamldbdiff.yml.examplerestructured: diff section (server1/server2/driver/type) is first-class and uncommented; migrationdatabasesection follows. Fully backwards-compatible — existing.dbdifffiles continue to work.New scripts
scripts/release-binaries.shscripts/test-release-podman.shscripts/update-homebrew-formula.shscripts/release.shbox.jsonREADME
Complete rewrite:
dbdiff.ymlFile Examples — single file covers both diff and migration modes, with config priority tablePre-merge checklist
build-phartested locally (box compileviaphp:8.3-cli-alpine→ passes)--versionreturnsDBDiff 2.0.0)docker/Dockerfile.slimbuilt locally (119 MB,--versionand--helppass)