fix(ci): set npm dist-tag for prereleases - #74
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
📝 WalkthroughWalkthroughThe release workflow derives an npm dist-tag from the release version, logs the selected tag, and passes it to each ChangesRelease dist-tag publishing
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/release.yml:
- Around line 63-74: Update the prereleaseId extraction in the release workflow
to inspect only the SemVer prerelease portion before any build metadata, so
1.0.0+build-alpha selects latest. Add a regression case covering this version
and expected npm tag, while preserving alpha, rc, and other prerelease tagging
behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 3dc32da6-4340-44f5-bce3-b8c1894e20ab
📒 Files selected for processing (1)
.github/workflows/release.yml
| const prereleaseId = version.match( | ||
| /^[^-]+-([0-9A-Za-z-]+)(?:[.+]|$)/, | ||
| )?.[1]; | ||
| let npmTag = "latest"; | ||
| if (prereleaseId === "alpha" || prereleaseId === "rc") { | ||
| npmTag = prereleaseId; | ||
| } else if (prereleaseId) { | ||
| npmTag = "next"; | ||
| } | ||
|
|
||
| console.log(`Publishing ${version} with npm dist-tag ${npmTag}.`); | ||
|
|
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== release workflow relevant section =="
sed -n '1,90p' .github/workflows/release.yml
sed -n '190,225p' .github/workflows/release.yml
echo
echo "== changed lines via git diff, if available =="
git diff -- .github/workflows/release.yml | sed -n '1,180p' || true
echo
echo "== programmatic regex behavior =="
node - <<'JS'
const versions = [
"1.0.0+build-alpha",
"1.0.0-alpha.1",
"1.0.0-rc.1",
"1.0.0-alpha+build.1",
"1.0.0-beta+build-alpha",
];
for (const version of versions) {
const prereleaseId = version.match(/^[^-]+-([0-9A-Za-z-]+)(?:[.+]|$)/)?.[1];
let npmTag = "latest";
if (prereleaseId === "alpha" || prereleaseId === "rc") {
npmTag = prereleaseId;
} else if (prereleaseId) {
npmTag = "next";
}
console.log(`${version} => prereleaseId=["${prereleaseId}"] npmTag=${npmTag}`);
}
console.log("fixed behavior:");
for (const version of versions) {
const prereleaseId = version.match(/^[^-+]+-([0-9A-Za-z-]+)(?:[.+]|$)/)?.[1];
let npmTag = "latest";
if (prereleaseId === "alpha" || prereleaseId === "rc") {
npmTag = prereleaseId;
} else if (prereleaseId) {
npmTag = "next";
}
console.log(`${version} => prereleaseId=["${prereleaseId}"] npmTag=${npmTag}`);
}
JSRepository: afx-team/evjs
Length of output: 4722
Exclude build metadata when selecting the npm dist-tag.
1.0.0+build-alpha is a stable SemVer version, but the current regex matches alpha and publishes it with the alpha tag. Parse only the prerelease portion, not build metadata after +, and add a regression case for 1.0.0+build-alpha with expected tag latest.
Suggested fix
const prereleaseId = version.match(
- /^[^-]+-([0-9A-Za-z-]+)(?:[.+]|$)/,
+ /^[^-+]+-([0-9A-Za-z-]+)(?:[.+]|$)/,
)?.[1];🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/release.yml around lines 63 - 74, Update the prereleaseId
extraction in the release workflow to inspect only the SemVer prerelease portion
before any build metadata, so 1.0.0+build-alpha selects latest. Add a regression
case covering this version and expected npm tag, while preserving alpha, rc, and
other prerelease tagging behavior.
Source: MCP tools
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2cd9c9263
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "--tag", | ||
| npmTag, |
There was a problem hiding this comment.
Preserve npm's stable-version downgrade guard
When a manual dispatch or GitHub release targets an unpublished stable version lower than one already in the registry, explicitly passing --tag latest makes npm publish it and repoint latest backward. I checked npm publish --help ([--tag <tag>]) and npm 11's publish implementation: the safeguard reporting Cannot implicitly apply the "latest" tag because previously published version ... is higher only runs when the tag is implicit, so this new argument bypasses it and can make ordinary installs downgrade. Pass an explicit tag only for prereleases, or independently reject stable versions older than the registry's current latest.
Useful? React with 👍 / 👎.
Summary
alphaandrcprereleases under matching tagsnextand stable releases tolatestnpm publishRoot cause
The release workflow pins npm 11.6.2, which rejects prerelease versions unless
npm publishreceives an explicit--tag. The v0.3.4-alpha.0 release therefore stopped at the first workspace before authentication or upload.Failed run: https://github.com/afx-team/evjs/actions/runs/30799090797/job/91639274626