ci: replace npm-publish.yml with a working lerna-aware implementation - #838
Closed
jinglongchenTS wants to merge 1 commit into
Closed
ci: replace npm-publish.yml with a working lerna-aware implementation#838jinglongchenTS wants to merge 1 commit into
jinglongchenTS wants to merge 1 commit into
Conversation
jinglongchenTS
force-pushed
the
ci/pr-preview-publish-github-packages
branch
from
August 20, 2026 06:25
235ba07 to
5f3f050
Compare
The previous npm-publish.yml called tradeshift/actions-workflow-npm's
generic single-package reusable workflow, which published nothing
useful in this 45-package lerna monorepo (root package.json isn't one
of the published @tradeshift/elements.* packages).
Same 'npm publish' comment trigger and OWNER/MEMBER guard as before,
now backed by a real lerna-aware implementation. See README.md
("How to test a PR before it's merged") for usage.
jinglongchenTS
force-pushed
the
ci/pr-preview-publish-github-packages
branch
from
August 20, 2026 06:31
5f3f050 to
6fb6eb8
Compare
5 tasks
Contributor
Author
|
Superseded by #839 — same branch, but pushed directly to this repo instead of from a fork, since fork-originated |
This was referenced Aug 20, 2026
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.
Summary
.github/workflows/npm-publish.ymlcalledtradeshift/actions-workflow-npm's genericcomment-npm-publish.yml@v1reusable workflow, which runsnpm version/npm publishat the repo root. That only works for a single-package repo (e.g.tradeshift.js→@tradeshift/api, example run).elementsis a 45-package lerna monorepo underpackages/components/*andpackages/core; the rootpackage.json("tradeshift-elements", unscoped) isn't one of the published@tradeshift/elements.*packages, so nothing useful ever got published — confirmed by commentingnpm publishon this PR, which triggered a run cancelled after ~4 seconds with zero steps executed.This replaces it with a real implementation, same
npm publishcomment trigger andOWNER/MEMBERauthor_associationguard as before. Usage is documented inREADME.md("How to test a PR before it's merged"):npm publish(no argument) →lerna version <explicit-version>bumps every package to the same version regardless of individual change status (matching this repo's fixed/lockstep versioning) and automatically rewrites@tradeshift/elements.*dependency ranges between the packages being published (verified locally: bumping to an explicit version updatedheader's dependency onapp-iconto match) — thenlerna publish from-packageactually publishes them, all under GitHub Packages with thepr-previewdist-tag.npm publish <name>→ publishes just one package (e.g.npm publish app-icon→@tradeshift/elements.app-icon,npm publish core/elements→@tradeshift/elements) as a manual override, via a directnpm version+npm publishin that package's directory. Doesn't rewrite that package's own dependency ranges, so only makes sense when nothing it depends on changed, or those are published separately too.0.0.0-<run_id>, matching the0.0.0-<sha>convention used by other Tradeshift repos' npm-publish workflows (swapping ingithub.run_idinstead of the commit sha specifically so re-runningnpm publishon the same commit — e.g. retrying after a transient failure — gets a distinct version instead of colliding with the previous attempt).lerna ls --json) for the all-packages case, with the exactnpm install ... --registry=https://npm.pkg.github.comcommand to try it.Confirmed downstream Renovate configs (e.g.
Apps, viaTradeshift/renovate-config) have noignoreUnstable/followTagsettings that would pick up these0.0.0--prerelease, non-latest-dist-tag versions.Testing this before merge
issue_comment(like most non-push/pull_requesttriggers) only runs the workflow file version that's on the repo's default branch — commenting on this PR won't exercise the new file until it's merged. Not blocking the review on it, but flagging so nobody's surprised the comment trigger doesn't "just work" on this PR itself.Test plan
actions/github-scriptJS syntax checked locally (js-yaml+node --check,${{ }}expressions substituted with placeholders)npm publish,npm publish app-icon,npm publish core/elements, unknown package name, extra whitespace) tested locally against the bash snippet — all resolve correctlylerna version <explicit-version> --no-push --no-git-tag-version --yesrun for real locally against this repo, confirmed it bumps all 45 packages and rewrites cross-package@tradeshift/elements.*dependency ranges, then reverted (did not publish)npm version --no-git-tag-version <explicit-version>(single-package path) run for real againstpackages/components/app-iconlocally, confirmed valid semver output, then revertedlerna publish, PR comment round-trip) — needs to land onmasterfirst, per the note above