Skip to content

Commit 3376c2e

Browse files
committed
docs(releasing): the two npm facts that bite at setup time
npm does not validate a trusted publisher configuration when it is saved -- its own documentation says a wrong repository or filename surfaces only on the first publish attempt -- and the Environment field must be left empty for a workflow that uses no GitHub environment. Both are the kind of thing that turns a two-minute setup into an afternoon. Also records why 0.9.0 carries no provenance (it was published by hand, to create the package) and npm's recommendation to disallow tokens once trusted publishing has worked once, which is what turns the absence of a token in this repository into a guarantee.
1 parent cda43c9 commit 3376c2e

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

RELEASING.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,28 @@ publishers**, add a GitHub Actions publisher with:
2020
| Repository | `react-native-nfc-kit` |
2121
| Workflow filename | `release.yml` |
2222

23+
Leave **Environment** empty: this workflow does not use a GitHub environment, and a
24+
value there would never match.
25+
2326
**The workflow filename is part of the trust configuration.** Renaming
2427
`.github/workflows/release.yml` breaks publishing until this is updated, and the
2528
failure looks like an authentication error rather than a configuration one.
2629

30+
**npm does not validate any of this when you save it.** Its own documentation says
31+
so: a wrong repository or filename surfaces only on the first publish attempt. So
32+
check the three values against this table rather than trusting the form.
33+
2734
The package must exist on npm first. For the very first publish, either create it
2835
with a manual `npm publish` from a machine that is logged in, or reserve the name
29-
and then let the workflow take over.
36+
and then let the workflow take over. `0.9.0` was published that way, which is why it
37+
carries no provenance attestations — those begin with the first release the workflow
38+
makes.
39+
40+
Once trusted publishing has published successfully at least once, tighten the
41+
package's **Settings → Publishing access** to _"Require two-factor authentication and
42+
disallow tokens"_. That is npm's own recommendation, and it is what makes the absence
43+
of a token here a guarantee rather than a preference: with it set, nothing can publish
44+
this package except this workflow.
3045

3146
## The everyday flow
3247

0 commit comments

Comments
 (0)