Commit 5ddaf20
authored
chore(release): set main sentinel version and guard stable publishes (#3923)
## Description
Adds two coupled changes for the release-branch workflow.
### 1. Pin `main` to a sentinel version (`1000.0.0`)
Bumps `package.json#version` on `main` to `1000.0.0`, per the release
guide (see
[labs#726](software-mansion/react-native-screens-labs#726)).
In the release-branch workflow, the version in `main/package.json` is
not a real release version — releases are cut from dedicated
`<major>.<minor>-stable` branches where the version is set
independently. Keeping `main` pinned to a recently-released value (e.g.
`4.24.0`) invites confusion and requires a bump on every release cut.
Alternatives have their own trade-offs — `react-native-reanimated` uses
a `<version>-main` suffix, which demands format discipline on every
bump; `react-native-gesture-handler` does nothing, and the version on
`main` silently drifts behind the real latest release. The sentinel
`1000.0.0` is deliberately absurd so nobody mistakes it for a real
release, requires no maintenance on release cuts, and still parses as
valid semver for tooling.
Closes
software-mansion/react-native-screens-labs#1167.
### 2. Guard the publish workflow against non-nightly publishes from
`main`
The sentinel is a clear *signal*, but without enforcement nothing
prevents an operator from triggering **Publish release to npm** on
`main` and pushing `[email protected]` to the registry. Adds
a pre-publish validation step in `publish-npm.yml` that invokes
`scripts/validate-publish-target.sh` whenever a non-nightly release is
triggered via `workflow_dispatch`. The script rejects:
- the sentinel version (`1000.*`),
- runs targeting `main`,
- branches that do not match the documented release-branch patterns
(`<major>.<minor>-stable` or `v<major>-main`).
All failures are surfaced in a single run so an operator sees every
problem at once, not one at a time.
Nightly publishes from `main` remain intentionally untouched — they are
the designed exception per the release guide.
## Changes
- `package.json`: version `4.24.0` → `1000.0.0`.
- `.github/workflows/publish-npm.yml`: new `Validate publish target`
step, gated on `workflow_dispatch` with non-nightly `release-type`.
- `scripts/validate-publish-target.sh` (new): runs the three checks;
exit `0` on success, `1` on validation failure, `2` on usage error.
## Test plan
- Locally: `./scripts/validate-publish-target.sh main stable` against
current repo state → all three checks fail (sentinel + main + bad
pattern), exit `1`.
- Locally: `./scripts/validate-publish-target.sh 4.25-stable stable` →
sentinel check fires (`1000.0.0` on this branch), branch checks pass,
exit `1`.
- Locally: invocation with missing args → usage error, exit `2`.
- Post-merge: run `publish-npm.yml` in dry-run against `main` with
`release-type=stable` → expect the guard step to fail the workflow
before the publish action runs.
## Checklist
- [ ] Included code example that can be used to test this change.
- [ ] For visual changes, included screenshots / GIFs / recordings
documenting the change.
- [ ] For API changes, updated relevant public types.
- [ ] Ensured that CI passes1 parent ac58fdd commit 5ddaf20
3 files changed
Lines changed: 92 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
59 | 70 | | |
60 | 71 | | |
61 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 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 | + | |
0 commit comments