Skip to content

ci: replace npm-publish.yml with a working lerna-aware implementation - #839

Merged
jinglongchenTS merged 1 commit into
masterfrom
ci/pr-preview-publish-github-packages
Aug 20, 2026
Merged

ci: replace npm-publish.yml with a working lerna-aware implementation#839
jinglongchenTS merged 1 commit into
masterfrom
ci/pr-preview-publish-github-packages

Conversation

@jinglongchenTS

@jinglongchenTS jinglongchenTS commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

This replaces it with a real implementation, same npm publish comment trigger and OWNER/MEMBER author_association guard as before. Usage is documented in README.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 updated header's dependency on app-icon to match) — then lerna publish from-package actually publishes them, all under GitHub Packages with the pr-preview dist-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 direct npm version + npm publish in 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.
  • Version format: 0.0.0-<run_id>, matching the 0.0.0-<sha> convention used by other Tradeshift repos' npm-publish workflows (swapping in github.run_id instead of the commit sha specifically so re-running npm publish on the same commit — e.g. retrying after a transient failure — gets a distinct version instead of colliding with the previous attempt).
  • Success comment lists every published package (via lerna ls --json) for the all-packages case, with the exact npm install ... --registry=https://npm.pkg.github.com command to try it.

Confirmed downstream Renovate configs (e.g. Apps, via Tradeshift/renovate-config) have no ignoreUnstable/followTag settings that would pick up these 0.0.0--prerelease, non-latest-dist-tag versions.

Testing this before merge

issue_comment (like most non-push/pull_request triggers) 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.

Test plan

  • YAML validity + embedded actions/github-script JS syntax checked locally (js-yaml + node --check, ${{ }} expressions substituted with placeholders)
  • Comment-parsing logic (npm publish, npm publish app-icon, npm publish core/elements, unknown package name, extra whitespace) tested locally against the bash snippet — all resolve correctly
  • lerna version <explicit-version> --no-push --no-git-tag-version --yes run 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 against packages/components/app-icon locally, confirmed valid semver output, then reverted
  • Not yet exercised end-to-end in Actions (registry auth, real lerna publish, PR comment round-trip) — needs to land on master first, per the note above

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.
@upwind-code-us

upwind-code-us Bot commented Aug 20, 2026

Copy link
Copy Markdown

Upwind Upwind Code Scan - ✅ Proceed with Deployment

0 newly introduced vulnerabilities · 0 resolved · 0 total in this PR vs master

View full analysis in Upwind Console

Scan completed in 18s

Scan history (1 scan)
Commit Scanned at New Resolved Net
6fb6eb8 < 2026-08-20 07:01 UTC 0 0 0

Last scanned: 6fb6eb8 · 2026-08-20 07:01 UTC

@upwind-code-us

upwind-code-us Bot commented Aug 20, 2026

Copy link
Copy Markdown

Upwind Upwind IaC Scan - ✅ Proceed with Deployment

0 newly introduced misconfigurations · 0 resolved · 0 total in this PR vs main

View full analysis in Upwind Console →

Scan completed in 2s

Scan history (2 scans)
Commit Scanned at New Resolved Net
6fb6eb8 2026-08-20 07:01 UTC
6fb6eb8 < 2026-08-20 07:01 UTC 0 0 0

Last scanned: 6fb6eb8 · 2026-08-20 07:01 UTC

@ts-sonarqube

ts-sonarqube Bot commented Aug 20, 2026

Copy link
Copy Markdown

@jinglongchenTS
jinglongchenTS merged commit 745945a into master Aug 20, 2026
6 of 9 checks passed
@jinglongchenTS
jinglongchenTS deleted the ci/pr-preview-publish-github-packages branch August 20, 2026 07:16
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