Skip to content

ci(repo): consolidate publish into release-please workflow#70

Merged
anilanar merged 1 commit into
masterfrom
consolidate-publish-into-release-please
May 22, 2026
Merged

ci(repo): consolidate publish into release-please workflow#70
anilanar merged 1 commit into
masterfrom
consolidate-publish-into-release-please

Conversation

@anilanar
Copy link
Copy Markdown
Member

Summary

Move the npm publishing steps from a standalone publish.yml (triggered by release: published) into release-please.yml (triggered by push: branches: [master]), and delete publish.yml. This eliminates the manual gh release delete + gh release create dance that was needed on every release because of GitHub's "GITHUB_TOKEN events don't trigger workflows" rule.

This pattern is the one release-please's own README recommends — the action exposes per-path releases_created outputs we use to publish only the packages that were actually released.

Changes

  • release-please.yml:
    • Add id-token: write permission (for OIDC publish).
    • Add environment: npm-publish to the job (was previously on publish.yml; npm Trusted Publishers requires this in the OIDC token).
    • Append the build / pack / npm stage publish steps, each gated on steps.release.outputs.releases_created == 'true' (and per-package outputs for the per-package stage steps).
  • publish.yml: deleted.

Required follow-up actions after this merges

  1. On npmjs.com Trusted Publishers — update the workflow filename from publish.ymlrelease-please.yml for BOTH packages:

    • @userlike/messenger
    • @userlike/messenger-internal

    Environment name stays as npm-publish.

  2. (Optional) Simplify the GitHub Environment at Settings → Environments → npm-publish: you can drop the @userlike/* tag pattern from "Deployment branches and tags" — releases no longer trigger publishing, so only master is needed.

Test plan

This PR is itself a ci(repo): commit (touches .github/workflows/* only, no package files), so:

  • CI green
  • After merge, release-please workflow runs and does not open a Release PR (no releasable commits affected packages/*)
  • Then update npm TP config (step 1 above)
  • First real conventional-commit change after that should drive the full happy path: release-please opens Release PR → merge it → publish step in the same workflow fires → packages staged → human approves on npm.

GitHub's GITHUB_TOKEN-doesn't-trigger-workflows rule meant the
standalone publish.yml (triggered by release events) never fired
when release-please-action created GitHub releases via the default
token. Every release required a manual `gh release delete` +
`gh release create` workaround so the release event would fire
under a real user identity.

Per release-please's own README recommendation, do the publishing
in the same job as the action - then there's no inter-workflow
trigger to worry about. The action exposes per-path outputs we
use to publish only the packages that were actually released:

- steps.release.outputs.releases_created          (any release)
- steps.release.outputs['<path>--release_created'] (per-package)

Changes:
- release-please.yml: add id-token: write permission and
  environment: npm-publish (was previously only on publish.yml,
  bound by npm Trusted Publishers); append the build + pack +
  npm stage publish steps gated on the release-please outputs.
- Delete publish.yml entirely.

Follow-up actions required after this merges:
- Update npm Trusted Publishers config workflow filename from
  'publish.yml' -> 'release-please.yml' on npmjs.com for both
  @userlike/messenger and @userlike/messenger-internal.
- Optional: simplify the npm-publish GitHub Environment to
  master-only (drop the @userlike/* tag pattern), since releases
  no longer trigger publishing.
@anilanar anilanar merged commit f6b1d8a into master May 22, 2026
1 check passed
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