Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(build): complete the dockerignore, propagate postinstall failures, and repair release-doc references (#943)

Yudhi Armyndharisc37dc4e53d7a
diff --git a/.dockerignore b/.dockerignore
index 2f12f7bc2..bca194612 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,19 +1,46 @@
-# Dependencies
+# Dependencies — reinstalled inside the image via npm ci
node_modules/
+dashboard/node_modules/
-# Build output
+# Build output — rebuilt inside the image; local output/caches must not leak
+# into the builder's `COPY . .` (a stale tsbuildinfo can poison the build)
dist/
+dashboard/dist/
+*.tsbuildinfo
# Test coverage
coverage/
-# Environment files
-.env
-.env.local
-.env.*.local
+# Environment files — secrets, never a build input (every variant, any depth)
+.env*
+**/.env*
-# Data files (sessions, media, database)
+# Data files — runtime state (sessions, media, databases, API keys), never
+# part of the build context
data/
+*.db
+*.sqlite
+*.sqlite3
+
+# VCS metadata — not a build input; keeps history/hooks out of the context
+.git/
+
+# Private working material — internal notes that must never enter the build
+# context, the build cache, or any image layer
+_docs/
+
+# Agent/tool workspaces and caches — local-only, not build inputs
+.agent/
+.claude/
+.kimi-worktrees/
+.playwright-mcp/
+.remember/
+.superpowers/
+.worktrees/
+.wwebjs_cache/
+CLAUDE.md
+docs/plans/
+docs/superpowers/
# IDE
.idea/
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4450e83e5..297baa4cd 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -45,6 +45,11 @@ jobs:
- name: Check version consistency (docs track package.json)
run: npm run check:versions
+ # The builder stage ends with `COPY . .` — fail if .dockerignore stops rejecting non-build
+ # material (or starts rejecting a build input) before a Docker build finds out.
+ - name: Check Docker build context (.dockerignore)
+ run: npm run check:dockerignore
+
# The committed openapi.json is the machine-readable API contract. Fail if a controller/DTO
# change landed without regenerating the snapshot (npm run openapi:export). The generator
# bootstraps the app hermetically (in-memory/temp SQLite, no listen), so this is a static check.
@@ -97,6 +102,11 @@ jobs:
- name: Run unit tests
run: npm test -- --coverage
+ # node:test specs for the repo-level scripts (postinstall exit-code propagation) — jest's
+ # rootDir is src/, so these live outside its reach and run on the plain node runner.
+ - name: Run script unit tests
+ run: npm run test:scripts
+
- name: Run e2e smoke tests
run: npm run test:e2e
diff --git a/.github/workflows/java-sdk-release.yml b/.github/workflows/java-sdk-release.yml
index 95a7c9030..33d9739b9 100644
--- a/.github/workflows/java-sdk-release.yml
+++ b/.github/workflows/java-sdk-release.yml
@@ -1,7 +1,7 @@
name: Java SDK Release
# Publishes com.rmyndharis:openwa to Maven Central from sdk/java. Requires the one-time setup
-# (see sdk/java/README.md -> RELEASING); the publish secrets are verified up front and their
+# (see sdk/java/README.md -> Releasing); the publish secrets are verified up front and their
# absence FAILS the run instead of silently no-oping green:
# - MAVEN_CENTRAL_USERNAME / MAVEN_CENTRAL_PASSWORD (Sonatype Central user token halves)
# - GPG_PRIVATE_KEY (ASCII-armored signing key)
@@ -76,7 +76,7 @@ jobs:
if [ -z "${!name:-}" ]; then missing="$missing $name"; fi
done
if [ -n "$missing" ]; then
- echo "::error::Missing publish secret(s):$missing — configure them (see sdk/java/README.md -> RELEASING) before tagging a release."
+ echo "::error::Missing publish secret(s):$missing — configure them (see sdk/java/README.md -> Releasing) before tagging a release."
exit 1
fi
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index de998cc51..f1813f1fd 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -77,6 +77,10 @@ jobs:
- name: Check version consistency (docs track package.json)
run: npm run check:versions
+ # Same guard as CI: the published image is built from this ref, so the context must be sane.
+ - name: Check Docker build context (.dockerignore)
+ run: npm run check:dockerignore
+
- name: Check OpenAPI snapshot is up to date
run: npm run openapi:check
diff --git a/.github/workflows/split-php-sdk.yml b/.github/workflows/split-php-sdk.yml
index 43a773a88..29eb0cea7 100644
--- a/.github/workflows/split-php-sdk.yml
+++ b/.github/workflows/split-php-sdk.yml
@@ -8,7 +8,8 @@ name: Split PHP SDK
# IMPORTANT: this only syncs the `main` branch (-> Packagist `dev-main`). The
# monorepo's `v*` tags are the APP version, NOT the SDK version, so they are
# deliberately NOT propagated. To cut a versioned SDK release, tag the mirror
-# repo directly (see sdk/php — RELEASING below), e.g. `git tag 0.1.0`.
+# repo (rmyndharis/openwa-php) directly, e.g. `git tag 0.1.0` — Packagist reads
+# versions from the mirror's tags, never from this repo.
#
# One-time setup:
# 1. Create an empty GitHub repo: rmyndharis/openwa-php
diff --git a/Dockerfile b/Dockerfile
index 86ad31d35..fa6485e26 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -23,6 +23,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# Copy package files
COPY package*.json ./
+# The postinstall hook is a real file (scripts/postinstall.js), and `npm ci` fails outright when
+# a lifecycle script is missing — copy it BEFORE the install. dashboard/ and the backport patcher
+# are deliberately still absent at this point, so the hook cleanly no-ops here (dashboard deps are
+# installed explicitly below; the patcher only matters for the production stage).
+COPY scripts/postinstall.js ./scripts/
+
# Install all dependencies INCLUDING devDependencies — the build needs them (`nest` from
# @nestjs/cli, plus `vite`/`typescript` for the dashboard). `--include=dev` is REQUIRED, not
# cosmetic: npm omits devDependencies whenever NODE_ENV=production is present in the build env.
@@ -103,7 +109,10 @@ COPY package*.json ./
# Backport upstream whatsapp-web.js#201832 (id._serialized -> id.$1 normalization,
# broken by WA Web 2.3000.x ~2026-07-14) into the installed dep at build time.
# The patcher self-disables once whatsapp-web.js ships the fix upstream.
-COPY scripts/patch-wwebjs-201832.js scripts/wwebjs-201832.patch ./scripts/
+# scripts/postinstall.js rides along: `npm ci` below runs the hook, which fails
+# when the file is missing. With the patcher present the hook applies it in
+# --best-effort mode; the explicit fatal run right after is the real gate.
+COPY scripts/postinstall.js scripts/patch-wwebjs-201832.js scripts/wwebjs-201832.patch ./scripts/
# Install production dependencies only, then apply the backport patcher (needs `patch`).
RUN npm ci --omit=dev && node scripts/patch-wwebjs-201832.js && npm cache clean --force
diff --git a/package.json b/package.json
index 7f9951944..d11c1fb3e 100644
--- a/package.json
+++ b/package.json
@@ -26,13 +26,15 @@
"dashboard:ci": "cd dashboard && npm ci",
"dashboard:dev": "cd dashboard && npm run dev",
"dashboard:build": "cd dashboard && npm run build",
- "postinstall": "node -e \"const fs=require('fs'),cp=require('child_process'); if (fs.existsSync('dashboard')) cp.spawnSync('npm run dashboard:ci', { stdio: 'inherit', shell: true }); if (fs.existsSync('scripts/patch-wwebjs-201832.js')) cp.spawnSync(process.execPath, ['scripts/patch-wwebjs-201832.js', '--best-effort'], { stdio: 'inherit' });\"",
+ "postinstall": "node scripts/postinstall.js",
"check:versions": "node scripts/check-doc-versions.mjs",
+ "check:dockerignore": "node scripts/check-dockerignore.mjs",
"openapi:export": "ts-node scripts/export-openapi.ts openapi.json",
"openapi:check": "ts-node scripts/export-openapi.ts /tmp/openapi.generated.json && diff -u openapi.json /tmp/openapi.generated.json",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
+ "test:scripts": "node --test scripts/postinstall.spec.js",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
diff --git a/scripts/check-dockerignore.mjs b/scripts/check-dockerignore.mjs
new file mode 100644
index 000000000..e79377cfd
--- /dev/null
+++ b/scripts/check-dockerignore.mjs
@@ -0,0 +1,169 @@
+#!/usr/bin/env node
+/**
+ * Docker-context guard.
+ *
+ * The Dockerfile's builder stage ends with `COPY . .`, so anything the .dockerignore does not
+ * reject lands in the build context, the build cache, and a builder layer. This guard parses the
+ * committed .dockerignore with Docker's own matching semantics (patterns anchored at the context
+ * root, Go filepath.Match wildcards plus `**`, a pattern matching everything under a matched
+ * directory, last matching rule wins, `!` re-includes) and asserts two things:
+ *
+ * 1. Non-build / sensitive material (private working notes, VCS metadata, runtime data, local
+ * env files, agent/tool workspaces, dependency and build-output dirs) is rejected.
+ * 2. Every input the multi-stage build actually needs (package manifests, src/, the dashboard
+ * source, the backport patcher, docker-entrypoint.sh, TS configs) still passes.
+ *
+ * Run locally: `npm run check:dockerignore`. Runs in CI (lint job).
+ */
+import { readFileSync } from 'node:fs';
+
+const root = new URL('../', import.meta.url);
+const text = readFileSync(new URL('.dockerignore', root), 'utf8');
+
+// Translate one .dockerignore pattern to a RegExp. `**/` matches zero or more leading segments,
+// `**` any run of characters, `*`/`?` stay within a segment, `[...]` classes pass through, and
+// every other regex metacharacter is literal — mirroring Go's filepath.Match plus Docker's `**`.
+function globToRegExp(pattern) {
+ let re = '';
+ let i = 0;
+ while (i < pattern.length) {
+ if (pattern.startsWith('**/', i)) {
+ re += '(?:[^/]+/)*';
+ i += 3;
+ } else if (pattern.startsWith('**', i)) {
+ re += '.*';
+ i += 2;
+ } else if (pattern[i] === '*') {
+ re += '[^/]*';
+ i += 1;
+ } else if (pattern[i] === '?') {
+ re += '[^/]';
+ i += 1;
+ } else if (pattern[i] === '[') {
+ const j = pattern.indexOf(']', i + 1);
+ if (j === -1) {
+ re += '\\[';
+ i += 1;
+ } else {
+ re += pattern.slice(i, j + 1);
+ i = j + 1;
+ }
+ } else {
+ re += pattern[i].replace(/[.+^${}()|\\]/g, '\\$&');
+ i += 1;
+ }
+ }
+ return new RegExp(`^${re}$`);
+}
+
+// Parse: drop blanks/comments, honor `!` negation, strip surrounding slashes (a trailing slash
+// only marks "this is a directory" — Docker ignores it when matching).
+const rules = [];
+for (const raw of text.split('\n')) {
+ const line = raw.trim();
+ if (!line || line.startsWith('#')) continue;
+ const negate = line.startsWith('!');
+ const pattern = (negate ? line.slice(1) : line).replace(/^\/+|\/+$/g, '');
+ if (pattern) rules.push({ pattern, negate, re: globToRegExp(pattern) });
+}
+
+// Docker matches a pattern against the path AND every parent directory, so `data/` rejects
+// `data/main.sqlite` even though the pattern itself has no wildcard.
+function matches(re, path) {
+ for (let p = path; ; ) {
+ if (re.test(p)) return true;
+ const cut = p.lastIndexOf('/');
+ if (cut === -1) return false;
+ p = p.slice(0, cut);
+ }
+}
+
+function ignored(path) {
+ let result = false;
+ for (const rule of rules) {
+ if (matches(rule.re, path)) result = !rule.negate;
+ }
+ return result;
+}
+
+// Must NEVER reach the build context — grouped by category, mirroring the .dockerignore sections.
+const mustReject = [
+ // Dependencies (reinstalled via npm ci in the image)
+ 'node_modules/typescript/package.json',
+ 'dashboard/node_modules/vite/package.json',
+ // Build output / local compiler caches
+ 'dist/main.js',
+ 'dashboard/dist/index.html',
+ 'tsconfig.tsbuildinfo',
+ // Test coverage
+ 'coverage/lcov.info',
+ // Environment files (secrets)
+ '.env',
+ '.env.minimal',
+ '.env.production.local',
+ 'dashboard/.env.local',
+ // Runtime data (sessions, media, databases, keys)
+ 'data/main.sqlite',
+ 'data/.api-key',
+ 'openwa.sqlite',
+ 'backup.db',
+ // VCS metadata
+ '.git/HEAD',
+ '.git/hooks/pre-commit',
+ // Private working material
+ '_docs/notes.md',
+ // Agent/tool workspaces and caches
+ '.agent/state.json',
+ '.claude/settings.json',
+ '.kimi-worktrees/build-context/package.json',
+ '.playwright-mcp/shot.png',
+ '.remember/state.json',
+ '.superpowers/config.yml',
+ '.worktrees/topic/package.json',
+ '.wwebjs_cache/chrome/linux/chrome',
+ 'CLAUDE.md',
+ 'docs/plans/plan.md',
+ 'docs/superpowers/run.md',
+ // IDE
+ '.vscode/settings.json',
+];
+
+// Must STILL reach the build context — the multi-stage build fails without any of these.
+const mustKeep = [
+ 'package.json',
+ 'package-lock.json',
+ 'nest-cli.json',
+ 'tsconfig.json',
+ 'tsconfig.build.json',
+ 'src/main.ts',
+ 'dashboard/package.json',
+ 'dashboard/package-lock.json',
+ 'dashboard/index.html',
+ 'dashboard/vite.config.ts',
+ 'dashboard/src/main.tsx',
+ 'scripts/postinstall.js',
+ 'scripts/patch-wwebjs-201832.js',
+ 'scripts/wwebjs-201832.patch',
+ 'docker-entrypoint.sh',
+ 'docs/01-project-overview.md',
+];
+
+const errors = [];
+for (const path of mustReject) {
+ if (!ignored(path)) {
+ errors.push(`.dockerignore does not reject '${path}' — it would leak into the Docker build context/cache/layers.`);
+ }
+}
+for (const path of mustKeep) {
+ if (ignored(path)) {
+ errors.push(`.dockerignore rejects '${path}' — the Dockerfile build needs it in the context.`);
+ }
+}
+
+if (errors.length) {
+ console.error('\n✖ Docker-context check failed:');
+ for (const e of errors) console.error(` - ${e}`);
+ console.error('\nFix .dockerignore so non-build material stays out and build inputs stay in, then re-run `npm run check:dockerignore`.\n');
+ process.exit(1);
+}
+console.log(`✓ Docker-context check OK (${rules.length} .dockerignore rules, ${mustReject.length} rejected / ${mustKeep.length} kept paths asserted).`);
diff --git a/scripts/postinstall.js b/scripts/postinstall.js
new file mode 100644
index 000000000..b44696dda
--- /dev/null
+++ b/scripts/postinstall.js
@@ -0,0 +1,86 @@
+/**
+ * Post-install hook (npm `postinstall`).
+ *
+ * Two conditional steps, each skipped when its target is absent so the hook is a no-op where the
+ * piece is missing (the Docker builder stage copies package*.json long before any source):
+ *
+ * 1. `npm run dashboard:ci` when dashboard/ exists — the dashboard carries its own lockfile and
+ * the root install would otherwise leave it without dependencies. A failure here MUST abort
+ * the install: the old inline hook swallowed spawnSync's exit status, so a red dashboard
+ * install still reported `npm install` success and the breakage surfaced only at build/run
+ * time.
+ * 2. `node scripts/patch-wwebjs-201832.js --best-effort` when the patcher exists. The patcher
+ * itself decides fatality: under --best-effort it warns and exits 0 for a pristine-but-
+ * unpatched tree (no `patch` binary, Baileys-only user), but exits 1 for a HALF-patched
+ * tree — which must never be waved through. So a non-zero status here is propagated as-is.
+ *
+ * Structured like scripts/patch-wwebjs-201832.js: pure planning + injectable spawn, so the spec
+ * (scripts/postinstall.spec.js, node:test) exercises every branch without a real npm run.
+ */
+'use strict';
+
+const fs = require('fs');
+const path = require('path');
+const { spawnSync } = require('child_process');
+
+const ROOT = path.join(__dirname, '..');
+
+/** The steps to run for a given repo root, in order. */
+function planSteps(root) {
+ const steps = [];
+ if (fs.existsSync(path.join(root, 'dashboard'))) {
+ steps.push({
+ name: 'dashboard dependencies (npm run dashboard:ci)',
+ command: 'npm run dashboard:ci',
+ options: { stdio: 'inherit', shell: true, cwd: root },
+ });
+ }
+ const patcher = path.join(root, 'scripts', 'patch-wwebjs-201832.js');
+ if (fs.existsSync(patcher)) {
+ steps.push({
+ name: 'whatsapp-web.js backport (scripts/patch-wwebjs-201832.js --best-effort)',
+ command: process.execPath,
+ args: [patcher, '--best-effort'],
+ options: { stdio: 'inherit', cwd: root },
+ });
+ }
+ return steps;
+}
+
+/** Human-readable failure cause from a spawnSync result. */
+function failureReason(res) {
+ if (res.error) return `failed to start — ${res.error.message}`;
+ if (typeof res.status === 'number' && res.status !== 0) return `exit code ${res.status}`;
+ if (res.signal) return `killed by ${res.signal}`;
+ return null;
+}
+
+/**
+ * Run the planned steps, stopping at the first failure. Returns the process exit code (0 = all
+ * steps ran clean or were absent). `spawn` is injectable for tests.
+ */
+function run(root = ROOT, spawn = spawnSync) {
+ const steps = planSteps(root);
+ if (!steps.length) {
+ console.log('postinstall: no dashboard/ or patch script present — nothing to do.');
+ return 0;
+ }
+ for (const step of steps) {
+ const res = spawn(step.command, step.args, step.options);
+ const reason = failureReason(res ?? {});
+ if (reason) {
+ console.error(
+ `postinstall: ${step.name} failed (${reason}). The install is INCOMPLETE — ` +
+ 'fix the error above and re-run `npm install`.',
+ );
+ return 1;
+ }
+ }
+ return 0;
+}
+
+if (require.main === module) {
+ process.exit(run());
+}
+
+module.exports = { planSteps, failureReason, run, ROOT };
diff --git a/scripts/postinstall.spec.js b/scripts/postinstall.spec.js
new file mode 100644
index 000000000..3dd01fb76
--- /dev/null
+++ b/scripts/postinstall.spec.js
@@ -0,0 +1,109 @@
+/**
+ * Unit tests for scripts/postinstall.js (node:test — no jest, no deps).
+ * Run: `npm run test:scripts`.
+ *
+ * The spawn is injected, so every branch (success, non-zero exit, spawn error, signal, fail-fast
+ * ordering) is exercised without a real `npm run dashboard:ci`.
+ */
+'use strict';
+
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const fs = require('fs');
+const os = require('os');
+const path = require('path');
+
+const { planSteps, failureReason, run } = require('./postinstall.js');
+
+const OK = { status: 0, signal: null, error: null };
+
+/** Bare temp dir optionally holding a dashboard/ and/or the patch script. */
+function makeRoot({ dashboard = false, patcher = false } = {}) {
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'openwa-postinstall-'));
+ if (dashboard) fs.mkdirSync(path.join(root, 'dashboard'));
+ if (patcher) {
+ fs.mkdirSync(path.join(root, 'scripts'));
+ fs.writeFileSync(path.join(root, 'scripts', 'patch-wwebjs-201832.js'), '// stub\n');
+ }
+ return root;
+}
+
+/** spawnSync stand-in: records calls, replays the queued results in order. */
+function fakeSpawn(results) {
+ const calls = [];
+ let i = 0;
+ const spawn = (command, args, options) => {
+ calls.push({ command, args, options });
+ return results[Math.min(i++, results.length - 1)];
+ };
+ return { calls, spawn };
+}
+
+test('planSteps: empty root plans nothing', () => {
+ assert.deepEqual(planSteps(makeRoot()), []);
+});
+
+test('planSteps: dashboard only plans the dashboard install (shell, inherited stdio)', () => {
+ const steps = planSteps(makeRoot({ dashboard: true }));
+ assert.equal(steps.length, 1);
+ assert.equal(steps[0].command, 'npm run dashboard:ci');
+ assert.equal(steps[0].options.shell, true);
+ assert.equal(steps[0].options.stdio, 'inherit');
+});
+
+test('planSteps: patcher only plans the best-effort backport via the current node', () => {
+ const steps = planSteps(makeRoot({ patcher: true }));
+ assert.equal(steps.length, 1);
+ assert.equal(steps[0].command, process.execPath);
+ assert.match(steps[0].args[0], /patch-wwebjs-201832\.js$/);
+ assert.deepEqual(steps[0].args.slice(1), ['--best-effort']);
+});
+
+test('planSteps: both present plans dashboard first, patcher second', () => {
+ const steps = planSteps(makeRoot({ dashboard: true, patcher: true }));
+ assert.equal(steps.length, 2);
+ assert.equal(steps[0].command, 'npm run dashboard:ci');
+ assert.equal(steps[1].command, process.execPath);
+});
+
+test('run: nothing to do exits 0 and never spawns', () => {
+ const { calls, spawn } = fakeSpawn([OK]);
+ assert.equal(run(makeRoot(), spawn), 0);
+ assert.equal(calls.length, 0);
+});
+
+test('run: all steps succeed exits 0', () => {
+ const { calls, spawn } = fakeSpawn([OK, OK]);
+ assert.equal(run(makeRoot({ dashboard: true, patcher: true }), spawn), 0);
+ assert.equal(calls.length, 2);
+});
+
+test('run: non-zero dashboard install exits 1 and never reaches the patcher (fail-fast)', () => {
+ const { calls, spawn } = fakeSpawn([{ status: 1, signal: null, error: null }]);
+ assert.equal(run(makeRoot({ dashboard: true, patcher: true }), spawn), 1);
+ assert.equal(calls.length, 1);
+ assert.equal(calls[0].command, 'npm run dashboard:ci');
+});
+
+test('run: spawn error (npm not found) exits 1', () => {
+ const { spawn } = fakeSpawn([{ status: null, signal: null, error: new Error('spawn npm ENOENT') }]);
+ assert.equal(run(makeRoot({ dashboard: true }), spawn), 1);
+});
+
+test('run: step killed by a signal exits 1', () => {
+ const { spawn } = fakeSpawn([{ status: null, signal: 'SIGTERM', error: null }]);
+ assert.equal(run(makeRoot({ dashboard: true }), spawn), 1);
+});
+
+test('run: non-zero patcher exit propagates (half-patched tree must stay fatal)', () => {
+ const { calls, spawn } = fakeSpawn([{ status: 1, signal: null, error: null }]);
+ assert.equal(run(makeRoot({ patcher: true }), spawn), 1);
+ assert.equal(calls.length, 1);
+});
+
+test('failureReason: maps each spawnSync outcome to a cause (null = success)', () => {
+ assert.equal(failureReason(OK), null);
+ assert.equal(failureReason({ status: 2, signal: null, error: null }), 'exit code 2');
+ assert.equal(failureReason({ status: null, signal: 'SIGKILL', error: null }), 'killed by SIGKILL');
+ assert.match(failureReason({ status: null, signal: null, error: new Error('boom') }), /failed to start — boom/);
+});
diff --git a/sdk/java/README.md b/sdk/java/README.md
index e89af6c75..1704e0c11 100644
--- a/sdk/java/README.md
+++ b/sdk/java/README.md
@@ -129,3 +129,30 @@ mvn -B verify # compile + run the full test suite
Tests inject a recording `HttpTransport` and assert on the exact path — so the
regression that would ship a broken `messages/text` path (the real path is
`messages/send-text`) can never recur silently.
+
+## Releasing
+
+Publishing to Maven Central is done by the
+[`java-sdk-release.yml`](../../.github/workflows/java-sdk-release.yml) workflow,
+which deploys with `mvn -B -Prelease deploy`. The `release` profile attaches the
+sources/javadoc jars, GPG-signs every artifact, and auto-publishes via the
+Sonatype Central Publishing plugin — a plain `mvn verify` never runs any of it.
+
+One-time setup (repository secrets):
+
+- `MAVEN_CENTRAL_USERNAME` / `MAVEN_CENTRAL_PASSWORD` — the two halves of a
+ Sonatype Central Portal user token for the verified `com.rmyndharis`
+ namespace.
+- `GPG_PRIVATE_KEY` — ASCII-armored signing key.
+- `GPG_PASSPHRASE` — passphrase for that key.
+
+Until the secrets exist the workflow cleanly no-ops (it prints a notice and
+skips the deploy), so tagging early is harmless.
+
+Cutting a release:
+
+1. Bump `<version>` in `pom.xml` and land it on `main`.
+2. Tag that commit `java-sdk-v<version>` (e.g. `java-sdk-v0.1.1`) and push the
+ tag. The SDK has its own version line — the monorepo's `v*` tags are the app
+ version and never trigger an SDK publish.
+3. The workflow builds, signs, and publishes; Central syncs within a few hours.
diff --git a/sdk/java/pom.xml b/sdk/java/pom.xml
index d99798982..80e855d09 100644
--- a/sdk/java/pom.xml
+++ b/sdk/java/pom.xml
@@ -64,7 +64,7 @@
<profiles>
<!-- Activated only for publishing to Maven Central: `mvn -Prelease deploy`.
Requires a GPG signing key and Sonatype Central credentials — see
- README.md → RELEASING. Ordinary `mvn verify` never runs these. -->
+ README.md → Releasing. Ordinary `mvn verify` never runs these. -->
<profile>
<id>release</id>
<build>