Skip to content

ci: fix release-preview-publish.yml action#7723

Merged
aloisklink merged 4 commits into
mermaid-js:release/11.15.0from
aloisklink:ci/fix-release-preview-ci-action
May 7, 2026
Merged

ci: fix release-preview-publish.yml action#7723
aloisklink merged 4 commits into
mermaid-js:release/11.15.0from
aloisklink:ci/fix-release-preview-ci-action

Conversation

@aloisklink
Copy link
Copy Markdown
Member

📑 Summary

Note

This PR targets release/11.15.0 so we can use it straight away.

The release-preview-publish.yml action is often failing for recent v11 releases, see https://github.com/mermaid-js/mermaid/actions/runs/25491214960/job/74799431314 for an example.

npm publish now runs pnpm docs:verify-version, which will generally fail since we'd only update the docs to fix <MERMAID_RELEASE_VERSION> with the actual changeset PR.

I've updated this action to ignore this, and also bundle the @mermaid-js/parser package within the @mermaid-js/mermaid preview package we publish, so we don't have to mess with publishing a second version of that somewhere.

📏 Design Decisions

See the git log and each individual commit for more information!

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added necessary unit/e2e tests.
  • 📓 have added documentation. Make sure MERMAID_RELEASE_VERSION is used for all new features.
  • 🦋 If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

aloisklink added 4 commits May 7, 2026 20:01
Currently, `npm publish` runs `pnpm docs:verify-version`, which might
possible fail if there are any `<MERMAID_RELEASE_VERSION>` placeholders
in our docs.

I've made a new environment variable, `ONLY_WARN_ON_VERIFY_ERROR`, that
can be used to disable this behaviour, allowing us to publish release
previews.
If we don't have the `id-token: write` permission, there's no way we can
accidentally write the NPM!

But we still need `packages: write` to write to GitHub Packages.
Make sure that we use a preview tag for previews
Right now, since we're using `npm publish` instead of `pnpm publish`,
the `^workspace:` specifier in our `package.json` file won't work.

We're also not publishing a `@mermaid-js/parser` package.
Instead, we can use `pnpm pack` to create a `.tgz` that `npm publish`
can upload.

We can also use `bundledDependencies` to include the
`@mermaid-js/parser` package, in case the latest preview version of
mermaid requires new changes to that package.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 7, 2026

⚠️ No Changeset found

Latest commit: ab28d72

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 3.35%. Comparing base (84abc58) to head (ab28d72).
⚠️ Report is 38 commits behind head on release/11.15.0.

Files with missing lines Patch % Lines
...ackages/mermaid/scripts/update-release-version.mts 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##           release/11.15.0   #7723      +/-   ##
==================================================
+ Coverage             3.33%   3.35%   +0.01%     
==================================================
  Files                  542     541       -1     
  Lines                56881   56879       -2     
  Branches               839     842       +3     
==================================================
+ Hits                  1899    1906       +7     
+ Misses               54982   54973       -9     
Flag Coverage Δ
unit 3.35% <0.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ackages/mermaid/scripts/update-release-version.mts 2.27% <0.00%> (-0.06%) ⬇️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@argos-ci
Copy link
Copy Markdown

argos-ci Bot commented May 7, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 2 changed May 7, 2026, 12:23 PM

Copy link
Copy Markdown
Collaborator

@ashishjain0512 ashishjain0512 left a comment

Choose a reason for hiding this comment

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

[sisyphus-bot]

Tightly-scoped CI fix — the failure mode (preview publish runs docs:verify-version, which can't pass before the changeset PR substitutes <MERMAID_RELEASE_VERSION>) is well-explained, and the fix targets each piece narrowly. The linked failing run makes it easy to verify this matches reality.

What's working well

  • 🎉 [praise] Explicit permissions: block. contents: read + packages: write is exactly the least-privilege scope this workflow needs, and committing it explicitly closes off any future drift if the repo's default token permissions get loosened. Bonus that this came along for the ride rather than waiting for a separate hardening PR.
  • 🎉 [praise] Env-var opt-out is the right shape. ONLY_WARN_ON_VERIFY_ERROR=true is single-purpose, scoped to this one CI step (set inline under the publish step's env: block), and update-release-version.mts:20-23 keeps the failure message visible — it just doesn't fail the build. So users still see which files have placeholders, they just don't block the preview publish on it.
  • 🎉 [praise] pnpm pack + npm publish *.tgz split. Separating the artifact build from publishing makes failure diagnosis easier (you can inspect the tarball) and gives you a clean place to drop --tag preview so previews never accidentally land on latest.

Nits

  • 🟢 [nit] npm publish *.tgz glob. The shell glob assumes exactly one .tgz in the working directory after pnpm pack. That's almost certainly true here, but if any future step (or a leftover cache) puts another tarball in the same dir, the publish target becomes nondeterministic. Specifying the expected filename, or at least an ls *.tgz sanity check before publish, would make it bulletproof. Truly a nit — feel free to ignore.

Suggestions

  • 💡 [suggestion] Forward-port to develop. Same as #7658, this targets release/11.15.0 directly. Worth a tracking note (or a quick PR after this lands) to bring the workflow + script changes back to develop so the next release branch starts with the fix already in place.
  • 💡 [suggestion] Optional: tiny unit test for the env-var gate. update-release-version.mts:21-23 is one line of behavior change; not really worth a dedicated test, but if you wanted future-you protection from a regression here, a single vitest case asserting process.exit(0) when ONLY_WARN_ON_VERIFY_ERROR=true and placeholders are present would lock it in. Definitely not blocking.

Security

No XSS or injection surface — pure CI configuration plus a one-line env-var-gated exit code. Skipping the sub-agent pass. The newly explicit permissions: block is a net positive on the workflow's security posture.


LGTM, ship it. 🚀

@aloisklink aloisklink merged commit badfa30 into mermaid-js:release/11.15.0 May 7, 2026
15 checks passed
@aloisklink aloisklink deleted the ci/fix-release-preview-ci-action branch May 7, 2026 13:31
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