Commit 045a8ce
authored
fix: determine release packages by tag existence on GitHub instead of NPM (#116)
## Summary
The `get-release-packages.sh` script (used for independent-versioning
monorepos) determined which packages belonged to the current release by
querying the npm registry and including any package whose current
version was not yet published. That assumption only holds when this
action runs *before* npm publish.
In the modern publish-release workflow used in `MetaMask/core`,
`action-publish-release` now runs *after* `publish-npm`, so by the time
this script runs every package version may already be on the registry.
The resulting `RELEASE_PACKAGES` is empty,
`getReleaseNotesForMonorepoWithIndependentVersions` produces an empty
string, and the action fails with `The computed release notes are
empty.`
This PR replaces the npm check with a tag-existence check. For each
workspace, the script asks GitHub whether a tag of the form
`<name>@<version>` already exists for the current manifest version. If
the tag exists, the package is considered already released and excluded;
otherwise it's included. Private packages and `0.0.0` packages continue
to be skipped.
The output shape of `RELEASE_PACKAGES` is unchanged, so this is not a
breaking change for downstream steps.
### Behavior change vs. old npm-check
The selection criterion shifts from "not on npm" to "no release tag
exists." In practice these produce the same set for normal-path
consumers, since a version on npm normally corresponds to a tag this
action created. They can diverge in edge cases — e.g. a repo that uses
this action but skips creating tags, or a first-time use against a repo
that's never been tagged in the `<name>@<version>` format (everything
would be treated as unreleased on the first run). Worth calling out in
the release notes; a major version bump on the action tag may be
warranted.
### Other
Also bumps `.nvmrc` from `v14` to `lts/*` since Node.js 14 has been EOL
since April 2023. Happy to split this into a separate PR.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes core release-package selection for independent monorepos and
relies on GitHub API/tag conventions; edge cases (untyped repos or
missing tags) can differ from the old npm-based behavior.
>
> **Overview**
> Fixes independent monorepo releases when publish runs **after** npm
publish by changing how `get-release-packages.sh` picks packages for the
current release.
>
> **Release selection** no longer uses `npm view` (“version not on the
registry”). It now includes each public, non-`0.0.0` workspace whose
manifest version has **no** existing Git tag `<name>@<version>`, checked
via `gh api` (optional `RELEASE_TAGS_REPOSITORY` for tests).
`action.yml` passes `GH_TOKEN` into that step.
>
> **Docs and CI** update README to describe tag-based independent
versioning. The `updated-packages-test` workflow switches the fixture
from `snaps-skunkworks` to `MetaMask/snaps@v120.0.0`, sets
`RELEASE_TAGS_REPOSITORY`, and adjusts manifest bump/unbump expectations
(including patch-0 unbump semantics) so the script still expects **2**
packages in the release set.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f1503fe. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 9c1bbd4 commit 045a8ce
4 files changed
Lines changed: 41 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
56 | 63 | | |
57 | 64 | | |
58 | 65 | | |
| |||
71 | 78 | | |
72 | 79 | | |
73 | 80 | | |
74 | | - | |
75 | | - | |
| 81 | + | |
| 82 | + | |
76 | 83 | | |
77 | | - | |
78 | | - | |
| 84 | + | |
| 85 | + | |
79 | 86 | | |
80 | 87 | | |
81 | 88 | | |
| |||
91 | 98 | | |
92 | 99 | | |
93 | 100 | | |
94 | | - | |
| 101 | + | |
95 | 102 | | |
96 | | - | |
97 | | - | |
98 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
99 | 108 | | |
100 | 109 | | |
101 | 110 | | |
102 | 111 | | |
103 | | - | |
| 112 | + | |
104 | 113 | | |
105 | 114 | | |
106 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
0 commit comments