[PR #143] [MERGED] Multi-Platform Binary Distributions (Windows, Mac, Linux, npm) & Box PHAR Builds #278

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

📋 Pull Request Information

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

Base: masterHead: feature/dbdiff-multi-platform-binaries


📝 Commits (3)

  • 70a4f6c feat: multi-platform binary distribution via npm + GitHub Actions
  • a99fe01 feat: Docker registry publishing, unified config, PHP 8.1 floor, README overhaul
  • da55fe8 chore: drop Docker Hub, publish to GHCR only

📊 Changes

27 files changed (+4615 additions, -577 deletions)

View changed files

📝 .dockerignore (+2 -0)
📝 .github/workflows/release.yml (+470 -42)
📝 .github/workflows/tests.yml (+1 -1)
📝 .gitignore (+8 -0)
📝 README.md (+325 -284)
box.json (+20 -0)
📝 composer.json (+5 -4)
📝 composer.lock (+2785 -167)
📝 dbdiff.yml.example (+33 -26)
docker/Dockerfile.slim (+49 -0)
packages/@dbdiff/cli-darwin-arm64/package.json (+17 -0)
packages/@dbdiff/cli-darwin-x64/package.json (+17 -0)
packages/@dbdiff/cli-linux-arm64-musl/package.json (+18 -0)
packages/@dbdiff/cli-linux-arm64/package.json (+18 -0)
packages/@dbdiff/cli-linux-x64-musl/package.json (+18 -0)
packages/@dbdiff/cli-linux-x64/package.json (+18 -0)
packages/@dbdiff/cli-win32-arm64/package.json (+17 -0)
packages/@dbdiff/cli-win32-x64/package.json (+17 -0)
packages/@dbdiff/cli/README.md (+59 -0)
packages/@dbdiff/cli/bin/dbdiff.js (+97 -0)

...and 7 more files

📄 Description

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.

Platform Asset name
Linux x64 (glibc) dbdiff-linux-x64
Linux x64 (musl/Alpine) dbdiff-linux-x64-musl
Linux arm64 (glibc) dbdiff-linux-arm64
Linux arm64 (musl) dbdiff-linux-arm64-musl
macOS x64 dbdiff-darwin-x64
macOS arm64 (Apple Silicon) dbdiff-darwin-arm64
Windows x64 dbdiff-win32-x64.exe
Windows arm64 dbdiff-win32-arm64.exe

npm@dbdiff/cli meta-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 default GITHUB_TOKEN.

docker pull ghcr.io/dbdiff/dbdiff:latest          # GHCR (free, no secrets needed)
docker run --rm ghcr.io/dbdiff/dbdiff:latest --help

GitHub Actions

release.yml — new complete release pipeline triggered on v* tag push:

build-phar  ──┬── build-binary (matrix × 8 platforms)  ──→  publish (npm + GH Release)
              └── publish-docker (GHCR, slim + full)  [parallel]
  • build-phar — compiles dist/dbdiff.phar via Box, uploads as artifact
  • build-binary — matrix across 8 platform targets; SPC downloads sources, builds micro.sfx, stitches with PHAR
  • publish — creates GitHub Release, uploads all binaries + PHAR, publishes npm packages
  • publish-docker — pushes slim + full images to GHCR; login and push steps have continue-on-error: true with an if: always() summary step showing /⏭️/; multi-arch build (linux/amd64 + linux/arm64) via QEMU + buildx; GHA layer caching

tests.yml — PHP matrix minimum bumped 8.08.1


PHP 8.0 dropped — minimum now 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
  • Resolves the humbug/box build-time conflict that was failing CI

Unified config file (dbdiff.yml)

Previously the diff tool only looked for .dbdiff and the migration runner only looked for dbdiff.yml. Now FSGetter.php walks a fallback chain so one file drives both modes:

.dbdiffdbdiff.yml.dbdiff.ymldbdiff.yaml

dbdiff.yml.example restructured: diff section (server1/server2/driver/type) is first-class and uncommented; migration database section follows. Fully backwards-compatible — existing .dbdiff files continue to work.


New scripts

Script Purpose
scripts/release-binaries.sh Builds all 8 platform binaries locally via Podman
scripts/test-release-podman.sh End-to-end local release smoke test
scripts/update-homebrew-formula.sh Updates Homebrew tap formula for a new version
scripts/release.sh Updated to coordinate PHAR + binary + npm + GitHub Release
box.json Box compiler config for PHAR build

README

Complete rewrite:

  • Features section with Supabase link
  • Installation table with "Available on Releases?" column and PHP requirement callout (≥ 8.1 for PHAR/Composer; bundled 8.3 for binaries/Docker/npm)
  • Unified dbdiff.yml File Examples — single file covers both diff and migration modes, with config priority table
  • Docker section with registry pull commands and image variant table
  • Platform compatibility tables for MySQL, PostgreSQL, SQLite, and Dolt

Pre-merge checklist

  • build-phar tested locally (box compile via php:8.3-cli-alpine → passes)
  • Linux x64 binary built and smoke-tested locally (--version returns DBDiff 2.0.0)
  • docker/Dockerfile.slim built locally (119 MB, --version and --help pass)
  • GHCR package visibility set to Public after first release push

🔄 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/143 **Author:** [@jasdeepkhalsa](https://github.com/jasdeepkhalsa) **Created:** 3/6/2026 **Status:** ✅ Merged **Merged:** 3/7/2026 **Merged by:** [@jasdeepkhalsa](https://github.com/jasdeepkhalsa) **Base:** `master` ← **Head:** `feature/dbdiff-multi-platform-binaries` --- ### 📝 Commits (3) - [`70a4f6c`](https://github.com/DBDiff/DBDiff/commit/70a4f6c0d672f1fdc61a3176cb3d7b9643c9c099) feat: multi-platform binary distribution via npm + GitHub Actions - [`a99fe01`](https://github.com/DBDiff/DBDiff/commit/a99fe011a750c36a2c9dbb82246e53f5df4e9b2d) feat: Docker registry publishing, unified config, PHP 8.1 floor, README overhaul - [`da55fe8`](https://github.com/DBDiff/DBDiff/commit/da55fe81ff96575d30e96e732ae7400093eae931) chore: drop Docker Hub, publish to GHCR only ### 📊 Changes **27 files changed** (+4615 additions, -577 deletions) <details> <summary>View changed files</summary> 📝 `.dockerignore` (+2 -0) 📝 `.github/workflows/release.yml` (+470 -42) 📝 `.github/workflows/tests.yml` (+1 -1) 📝 `.gitignore` (+8 -0) 📝 `README.md` (+325 -284) ➕ `box.json` (+20 -0) 📝 `composer.json` (+5 -4) 📝 `composer.lock` (+2785 -167) 📝 `dbdiff.yml.example` (+33 -26) ➕ `docker/Dockerfile.slim` (+49 -0) ➕ `packages/@dbdiff/cli-darwin-arm64/package.json` (+17 -0) ➕ `packages/@dbdiff/cli-darwin-x64/package.json` (+17 -0) ➕ `packages/@dbdiff/cli-linux-arm64-musl/package.json` (+18 -0) ➕ `packages/@dbdiff/cli-linux-arm64/package.json` (+18 -0) ➕ `packages/@dbdiff/cli-linux-x64-musl/package.json` (+18 -0) ➕ `packages/@dbdiff/cli-linux-x64/package.json` (+18 -0) ➕ `packages/@dbdiff/cli-win32-arm64/package.json` (+17 -0) ➕ `packages/@dbdiff/cli-win32-x64/package.json` (+17 -0) ➕ `packages/@dbdiff/cli/README.md` (+59 -0) ➕ `packages/@dbdiff/cli/bin/dbdiff.js` (+97 -0) _...and 7 more files_ </details> ### 📄 Description ## 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](https://github.com/DBDiff/homebrew-dbdiff) 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](https://github.com/box-project/box) and static self-contained executables built with [static-php-cli](https://github.com/crazywhalecc/static-php-cli) — PHP 8.3 micro SAPI + PHAR stitched together. No PHP, Composer, or Node required. | Platform | Asset name | |---|---| | Linux x64 (glibc) | `dbdiff-linux-x64` | | Linux x64 (musl/Alpine) | `dbdiff-linux-x64-musl` | | Linux arm64 (glibc) | `dbdiff-linux-arm64` | | Linux arm64 (musl) | `dbdiff-linux-arm64-musl` | | macOS x64 | `dbdiff-darwin-x64` | | macOS arm64 (Apple Silicon) | `dbdiff-darwin-arm64` | | Windows x64 | `dbdiff-win32-x64.exe` | | Windows arm64 | `dbdiff-win32-arm64.exe` | **npm** — `@dbdiff/cli` meta-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 default `GITHUB_TOKEN`. ```bash docker pull ghcr.io/dbdiff/dbdiff:latest # GHCR (free, no secrets needed) docker run --rm ghcr.io/dbdiff/dbdiff:latest --help ``` --- ### GitHub Actions **`release.yml`** — new complete release pipeline triggered on `v*` tag push: ``` build-phar ──┬── build-binary (matrix × 8 platforms) ──→ publish (npm + GH Release) └── publish-docker (GHCR, slim + full) [parallel] ``` - **`build-phar`** — compiles `dist/dbdiff.phar` via Box, uploads as artifact - **`build-binary`** — matrix across 8 platform targets; SPC downloads sources, builds `micro.sfx`, stitches with PHAR - **`publish`** — creates GitHub Release, uploads all binaries + PHAR, publishes npm packages - **`publish-docker`** — pushes slim + full images to GHCR; login and push steps have `continue-on-error: true` with an `if: always()` summary step showing ✅/⏭️/❌; multi-arch build (`linux/amd64` + `linux/arm64`) via QEMU + buildx; GHA layer caching **`tests.yml`** — PHP matrix minimum bumped `8.0` → `8.1` --- ### PHP 8.0 dropped — minimum now 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 - Resolves the `humbug/box` build-time conflict that was failing CI --- ### Unified config file (`dbdiff.yml`) Previously the diff tool only looked for `.dbdiff` and the migration runner only looked for `dbdiff.yml`. Now `FSGetter.php` walks a fallback chain so one file drives both modes: `.dbdiff` → `dbdiff.yml` → `.dbdiff.yml` → `dbdiff.yaml` `dbdiff.yml.example` restructured: diff section (`server1`/`server2`/`driver`/`type`) is first-class and uncommented; migration `database` section follows. Fully backwards-compatible — existing `.dbdiff` files continue to work. --- ### New scripts | Script | Purpose | |---|---| | `scripts/release-binaries.sh` | Builds all 8 platform binaries locally via Podman | | `scripts/test-release-podman.sh` | End-to-end local release smoke test | | `scripts/update-homebrew-formula.sh` | Updates Homebrew tap formula for a new version | | `scripts/release.sh` | Updated to coordinate PHAR + binary + npm + GitHub Release | | `box.json` | Box compiler config for PHAR build | --- ### README Complete rewrite: - Features section with [Supabase](https://supabase.com) link - Installation table with "Available on Releases?" column and PHP requirement callout (≥ 8.1 for PHAR/Composer; bundled 8.3 for binaries/Docker/npm) - Unified `dbdiff.yml` File Examples — single file covers both diff and migration modes, with config priority table - Docker section with registry pull commands and image variant table - Platform compatibility tables for MySQL, PostgreSQL, SQLite, and Dolt --- ### Pre-merge checklist - [x] `build-phar` tested locally (`box compile` via `php:8.3-cli-alpine` → passes) - [x] Linux x64 binary built and smoke-tested locally (`--version` returns `DBDiff 2.0.0`) - [x] `docker/Dockerfile.slim` built locally (119 MB, `--version` and `--help` pass) - [ ] GHCR package visibility set to Public after first release push --- <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:38 +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#278
No description provided.