ci(repo): consolidate publish into release-please workflow#70
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Move the npm publishing steps from a standalone
publish.yml(triggered byrelease: published) intorelease-please.yml(triggered bypush: branches: [master]), and deletepublish.yml. This eliminates the manualgh release delete+gh release createdance 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_createdoutputs we use to publish only the packages that were actually released.Changes
release-please.yml:id-token: writepermission (for OIDC publish).environment: npm-publishto the job (was previously on publish.yml; npm Trusted Publishers requires this in the OIDC token).npm stage publishsteps, each gated onsteps.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
On npmjs.com Trusted Publishers — update the workflow filename from
publish.yml→release-please.ymlfor BOTH packages:@userlike/messenger@userlike/messenger-internalEnvironment name stays as
npm-publish.(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 onlymasteris needed.Test plan
This PR is itself a
ci(repo):commit (touches.github/workflows/*only, no package files), so:packages/*)