Skip to content

fix(ci): set npm dist-tag for prereleases - #74

Merged
xusd320 merged 1 commit into
mainfrom
zoomdong/fix-prerelease-npm-tag
Aug 3, 2026
Merged

fix(ci): set npm dist-tag for prereleases#74
xusd320 merged 1 commit into
mainfrom
zoomdong/fix-prerelease-npm-tag

Conversation

@fireairforce

@fireairforce fireairforce commented Aug 3, 2026

Copy link
Copy Markdown
Member

Summary

  • infer the npm dist-tag from the release version before publishing
  • publish alpha and rc prereleases under matching tags
  • route other prereleases to next and stable releases to latest
  • pass the resolved tag explicitly to every workspace npm publish

Root cause

The release workflow pins npm 11.6.2, which rejects prerelease versions unless npm publish receives 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

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The release workflow derives an npm dist-tag from the release version, logs the selected tag, and passes it to each npm publish command.

Changes

Release dist-tag publishing

Layer / File(s) Summary
Select and apply npm dist-tag
.github/workflows/release.yml
The workflow maps release versions to latest, alpha, rc, or next, logs the selected tag, and passes it to npm publication.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: xusd320

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: configuring npm dist-tags for prerelease publishing in CI.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch zoomdong/fix-prerelease-npm-tag

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fireairforce
fireairforce marked this pull request as ready for review August 3, 2026 09:25
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@fireairforce
fireairforce requested a review from xusd320 August 3, 2026 09:25
@fireairforce
fireairforce marked this pull request as draft August 3, 2026 09:27
@fireairforce
fireairforce marked this pull request as ready for review August 3, 2026 09:28
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@xusd320
xusd320 merged commit f7c539f into main Aug 3, 2026
1 of 2 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2fa6d96 and b2cd9c9.

📒 Files selected for processing (1)
  • .github/workflows/release.yml

Comment on lines +63 to +74
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}.`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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}`);
}
JS

Repository: 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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +210 to +211
"--tag",
npmTag,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants