Commit 247da69
committed
fix: unify all npm publish workflows into a single top-level publish-npm.yml
## Problem
npm Trusted Publishing matches the `workflow_ref` OIDC claim, which
is always the top-level workflow filename. npm allows only ONE trusted
publisher per package. The prior migration (#57099) used
`workflow_call` to route all publishes through `publish-npm.yml`,
but `workflow_ref` resolves to the *caller* (e.g. `nightly.yml`),
not the reusable child — so the Trusted Publisher entry for
`publish-npm.yml` never matches.
## Solution
Merge all three publish entry points into `publish-npm.yml` itself,
triggered by all three event types:
- `push.tags: v0.*` → release mode (was publish-release.yml)
- `schedule + workflow_dispatch` → nightly mode (was nightly.yml)
- `push.branches: main, *-stable` → bumped-packages mode
(was publish-bumped-packages.yml)
A `determine_mode` job inspects the trigger and sets the mode.
Downstream jobs use conditional `if:` expressions to run only
the relevant build/publish steps.
Since `publish-npm.yml` is now always the top-level workflow,
`workflow_ref` always resolves to `publish-npm.yml` ✅.
## Key design points
- **No JS changes** — the publish scripts are unchanged. The build
and publish still happen in the same job, on the same runner, with
the same container. No artifact handoff or pack-only mode needed.
- **Reusable workflow_call children are fine** — prebuild-ios-*.yml,
generate-changelog.yml, etc. remain as `workflow_call` children.
Only the file that calls `npm publish` must be the top-level
workflow; child workflows don't affect the OIDC claim.
- **Old workflow files kept as stubs** — publish-release.yml,
nightly.yml, and publish-bumped-packages.yml are replaced with
minimal deprecation notices so that external links/dashboards
don't 404.
- **`always()` + explicit result checks** — publish_react_native
depends on build_android (nightly-only) and prebuild_* jobs.
In release mode, build_android is skipped. The `always()`
prevents cascading skips, while explicit result checks ensure
we don't publish after a failed build.
## npm Trusted Publisher config (manual step)
For each of the 24 packages, configure on npmjs.com:
Organization: react
Repository: react-native
Workflow: publish-npm.yml
Environment: npm-publish1 parent 79adce3 commit 247da69
4 files changed
Lines changed: 251 additions & 307 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | 7 | | |
| 8 | + | |
| 9 | + | |
4 | 10 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | 15 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | 7 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments