Skip to content

Trigger Publish workflow on release published, not push to main - #61

Merged
JLarky merged 1 commit into
mainfrom
unify-publish-trigger
May 5, 2026
Merged

Trigger Publish workflow on release published, not push to main#61
JLarky merged 1 commit into
mainfrom
unify-publish-trigger

Conversation

@JLarky

@JLarky JLarky commented May 5, 2026

Copy link
Copy Markdown
Owner

Summary

Align the JSR Publish trigger with the pattern used in JLarky/lima-escape and JLarky/lima-code: real publishes only happen when a GitHub release is actually published.

   on: {
-    push: {
-      branches: ["main"],
-    },
+    release: { types: ["published"] },
+    workflow_dispatch: {},
   },

Why this isn't a correctness fix

`bunx jsr publish` already no-ops on already-published versions (`Warning: Skipping, already published @jlarky/gha-ts@0.2.1`, exit 0), so the previous trigger wasn't producing red CI. This is purely a clarity change — the workflow's trigger now matches the event that actually causes a publish, and matches the convention used across the other @JLarky Deno packages.

Release flow (already in place)

  1. Bump `version` in `jsr.json` → push to `main`.
  2. `create-release` drafts a `v` GitHub release (existing behavior).
  3. Review the draft → click Publish release.
  4. `publish` fires → `bunx jsr publish` via OIDC.

`workflow_dispatch` is kept so the workflow can still be triggered manually if needed.

Test plan

  • `mise run workflows:build` regenerates `publish.generated.yml` cleanly
  • After merge, confirm a no-op push to `main` no longer triggers the Publish workflow
  • On the next `jsr.json` bump, confirm `create-release` drafts a release and publishing it fires the Publish workflow successfully via OIDC

🤖 Generated with Claude Code


Summary by cubic

Switch the Publish workflow to run on GitHub release publish instead of pushes to main, keeping manual runs via workflow_dispatch. This matches other @jlarky packages and avoids unnecessary runs.

  • Refactors
    • Change trigger to release: ["published"]; remove push: branches: ["main"].
    • Keep workflow_dispatch for manual triggers.
    • No behavior change; bunx jsr publish already no-ops on published versions.

Written for commit 891c979. Summary will update on new commits.

Aligns with the pattern used by JLarky/lima-escape and JLarky/lima-code:
real publishes only happen when a GitHub release is actually published.
The companion create-release workflow already drafts a release on
jsr.json changes, so the loop closes naturally — bump version, review
the draft, click Publish release, OIDC fires the publish.

bunx jsr publish was already a no-op on already-published versions
(emits "Skipping, already published" and exits 0), so this isn't a
correctness fix — but it makes the workflow's intent match what
actually causes a publish, and matches the pattern used by other
@JLarky packages. workflow_dispatch is kept as an escape hatch.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 2 files

@JLarky
JLarky merged commit ed667e4 into main May 5, 2026
17 of 19 checks passed
@JLarky
JLarky deleted the unify-publish-trigger branch May 5, 2026 17:39
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.

1 participant