fix(ci): publish releases under an explicit dist-tag - #678
Draft
iagoaraujo wants to merge 1 commit into
Draft
Conversation
npm refuses to implicitly move "latest" backwards, so publishing 6.51.1 failed because 7.4.2 already holds that tag. The publish step now resolves the dist-tag from the major version, keeping the 7.x line on "latest" and sending older majors to their own tag. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
v6.51.1release never reached npm. The publish workflow ran (run 31034142378), pulledvtex-api-6.51.1.tgzfrom CodeArtifact, and then failed on the last step:The publish step only passed
--tagfor thebetaenvironment:For
productionit passed no tag at all, so npm tried to movelatestfrom 7.4.2 down to 6.51.1 and refused. This is whyv6.51.1-betapublished fine whilev6.51.1did not — the beta path always had an explicit tag, so it never exercised the bug. It is also why the 7.x line has never hit this: forv7.4.2the implicitlatestis correct, since it is the highest published version.Note that
lintandci:testfailing on6.xare unrelated to this. Those come from thenode-ci-v2pipeline, which.vtex/deployment.yamltriggers on branch pushes; tag pushes runnpm-publish-v1, which only executesci:build.Change
The publish step now always resolves an explicit dist-tag:
betafor the beta environment,latestfor major >= 7, andv{major}-latestotherwise. The leadingvfrom the git tag name is stripped before the comparison, so bothv6.51.1and6.51.1resolve identically.This is a port of the logic in
ee2b88c7("fixing ci by adding custom latest tags"), which only ever lived onjulio/fix-npm-publish-ciand was never merged into6.xormaster. One difference: that version did not strip thev, soMAJORbecamev6, the numeric comparison errored out, and the tag came out asvv6-latest— which is why that odd dist-tag currently holds6.51.0on npm.Follow-ups
mastercarries the same old script. It works today only because 7.x is the highest major, so the same fix should be ported there for consistency.v1-latest,v3-latestand the accidentalvv6-latest. With this change the v6 line publishes tov6-latest. Whoever tracksvv6-latestwould stay on 6.51.0, so that tag should either be re-pointed (npm dist-tag add @vtex/api@6.51.1 vv6-latest) or deprecated.Test plan
publishjob)v6.51.1/6.51.1->v6-latest,v7.4.2/7.4.2->latest,v10.0.0->latest, and any version withenvironment=beta->beta6.xafter merge and confirm the publish lands onv6-latestMade with Cursor