Skip to content

fix(ci): run refresh-assets before package diff check in publish-patch#8276

Merged
MitjaBezensek merged 1 commit intomainfrom
mitja/fix-patch-releases
Mar 25, 2026
Merged

fix(ci): run refresh-assets before package diff check in publish-patch#8276
MitjaBezensek merged 1 commit intomainfrom
mitja/fix-patch-releases

Conversation

@MitjaBezensek
Copy link
Copy Markdown
Contributor

@MitjaBezensek MitjaBezensek commented Mar 18, 2026

In order to stop docs-only hotfixes from triggering unwanted npm patch releases, this PR adds yarn refresh-assets --force before the getAnyPackageDiff() check in publish-patch.ts.

Root cause

PR #8204 added .yarn/install-state.gz to the CI cache. When Yarn determines that the install state hasn't changed (e.g. node_modules is already populated and no dependencies changed), it skips lifecycle scripts including postinstall (related discussion). This means the postinstall hook (husky install && yarn refresh-assets) never runs.

Without refresh-assets, the gitignored asset directories in @tldraw/assets (embed-icons/, fonts/, icons/, translations/) don't exist on disk. The getAnyPackageDiff() guard runs yarn pack which produces a tarball missing these dirs (14 files), while the npm-published tarball has them (265 files) — always finding a diff, always publishing.

Before #8204 (working): PR #8102 docs hotfix cherry-picked to v4.4.x — publish-patch skipped correctly, no version bump.

After #8204 (broken): PRs #8263 and #8270 docs hotfixes cherry-picked to v4.5.x — both triggered unwanted npm publishes (v4.5.1 and v4.5.2).

Why this approach

Considered three options:

  1. Remove install-state.gz from cache — doesn't actually help; Yarn skips postinstall based on dependency changes, not just the state file
  2. Add refresh-assets to the setup action — overkill; lazyrepo already auto-runs it as a dependency of build, build-types, and dev
  3. Add refresh-assets to publish-patch.ts — targeted fix matching what trigger-sdk-hotfix.ts already does (line 98)

Option 3 is the right call. publish-patch.ts is the only workflow confirmed broken — everything else is protected by either lazyrepo's dependency graph or explicit refresh-assets calls in the workflow YAML.

Change type

  • bugfix

Test plan

Verified locally:

  1. Removed asset dirs to simulate CI with warm cache (no postinstall)
  2. yarn pack on @tldraw/assets → 14 files
  3. Ran yarn refresh-assets --force
  4. yarn pack again → 265 files

On a release branch with only docs changes, getAnyPackageDiff() should now return null → "No packages have changed, skipping release" → no publish.

Code changes

Section LOC change
Config/tooling +4 / -0

This prevents releasing a new patch version when doing a simple docs
hotfix.
@huppy-bot huppy-bot bot added the bugfix Bug fix label Mar 18, 2026
@vercel vercel bot temporarily deployed to Preview – chat-template March 18, 2026 13:51 Inactive
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
examples Ready Ready Preview Mar 18, 2026 1:52pm
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
analytics Ignored Ignored Mar 18, 2026 1:52pm
tldraw-docs Ignored Ignored Mar 18, 2026 1:52pm
chat-template Skipped Skipped Mar 18, 2026 1:52pm
tldraw-shader Skipped Skipped Mar 18, 2026 1:52pm
workflow-template Skipped Skipped Mar 18, 2026 1:52pm

Request Review

Copy link
Copy Markdown
Member

@mimecuvalo mimecuvalo left a comment

Choose a reason for hiding this comment

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

i think this is good to go

@MitjaBezensek MitjaBezensek added this pull request to the merge queue Mar 25, 2026
Merged via the queue into main with commit 85bb16e Mar 25, 2026
25 checks passed
@MitjaBezensek MitjaBezensek deleted the mitja/fix-patch-releases branch March 25, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants