@@ -4,6 +4,15 @@ name: publish-npm
44# in tier order (a dependency never lands after its dependent). Mirrors
55# publish-csharp.yml / publish-python.yml: tag-triggered or manual.
66#
7+ # WHICH packages, and in WHAT ORDER, is NOT decided here — `scripts/publish-set.mjs`
8+ # is the single source of truth, shared with the local `bun run release` path. This
9+ # workflow used to carry its own hardcoded list of 13 directories, which drifted from
10+ # that derivation: @metaobjectsdev/docs-site is a runtime dependency of
11+ # @metaobjectsdev/cli but was never in the list, so a release cut through here would
12+ # have shipped a cli pinning a docs-site version nobody published — an uninstallable
13+ # tarball, discoverable only by an external `npm install`. A list that is derived
14+ # cannot drift from the derivation.
15+ #
716# This publishes the versions ALREADY COMMITTED in each package.json at the tagged
817# commit — bump + commit them first (locally: `bun run release <ver>` does the
918# bump/build/verify/publish in one shot WITH a confirm gate; this workflow is the
3847 bun install --frozen-lockfile
3948 bun run build
4049
50+ - name : Derive + verify the publish set
51+ run : node scripts/publish-set.mjs --check
52+
4153 - name : Pack-verify the cli tarball pins siblings (no workspace:*)
4254 run : |
4355 set -euo pipefail
@@ -60,15 +72,15 @@ jobs:
6072 run : |
6173 set -euo pipefail
6274 echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
75+ trap 'rm -f ~/.npmrc' EXIT
6376 pub() { ( cd "$1" && bun publish --access public ) && echo " ✓ $1"; }
64- # tier 0 → 4 (deps before dependents)
65- for d in server/typescript/packages/metadata server/typescript/packages/render \
66- server/typescript/packages/codegen-ts server/typescript/packages/runtime-ts \
67- server/typescript/packages/migrate-ts server/typescript/packages/sdk \
68- client/web/packages/runtime-web \
69- server/typescript/packages/codegen-ts-react server/typescript/packages/codegen-ts-tanstack \
70- client/web/ packages/react client/web/packages/tanstack \
71- server/typescript/packages/cli server/typescript/packages/ai-runtime ; do
77+ # The set and its tier order (deps before dependents) come from the shared
78+ # derivation, never from a list maintained here. Written to a file first so a
79+ # non-zero exit fails the step instead of yielding a silently short list.
80+ node scripts/publish-set.mjs > "${RUNNER_TEMP}/publish-set.txt"
81+ mapfile -t DIRS < "${RUNNER_TEMP}/publish-set.txt"
82+ [ "${#DIRS[@]}" -gt 0 ] || { echo "::error::derived publish set is empty"; exit 1; }
83+ echo "publishing ${#DIRS[@]} packages in tier order"
84+ for d in "${DIRS[@]}" ; do
7285 pub "$d"
7386 done
74- rm -f ~/.npmrc
0 commit comments