close
Skip to content

Create GitHub Release on every npm publish#3429

Merged
adamziel merged 5 commits intotrunkfrom
adamziel/gh-release-on-publish
Mar 24, 2026
Merged

Create GitHub Release on every npm publish#3429
adamziel merged 5 commits intotrunkfrom
adamziel/gh-release-on-publish

Conversation

@adamziel
Copy link
Copy Markdown
Collaborator

@adamziel adamziel commented Mar 23, 2026

What it does

Creates a GitHub Release automatically after every npm publish. The release has no binary assets – just the changelog for that version, an npm install command, and a note about subscribing to releases via Watch → Custom → Releases.

Rationale

People who depend on WordPress Playground don't have an easy way to know when a new version ships. GitHub Releases are the standard mechanism for this – they show up in the repo's release feed and anyone watching releases gets notified.

Implementation

New workflow .github/workflows/publish-github-release.yml that:

  1. Triggers via workflow_run after the Release NPM packages workflow succeeds on trunk
  2. Reads the version from lerna.json
  3. Extracts the matching section from CHANGELOG.md using awk
  4. Calls gh release create with --target trunk
  5. Skips gracefully if the release already exists

Triggering directly off the npm release workflow (instead of the changelog workflow) ensures we only create a GitHub Release when packages actually ship to npm — not when the changelog updates for other reasons like self-hosted releases.

Testing instructions

@adamziel adamziel requested review from a team, JanJakes and Copilot March 23, 2026 13:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an automated GitHub Release step after successful npm publishes (via the existing changelog-update workflow), so watchers can subscribe to release notifications.

Changes:

  • Introduces a new GitHub Actions workflow triggered by workflow_run after “Update CHANGELOG.md” completes on trunk
  • Reads the version from lerna.json, extracts the matching section from CHANGELOG.md, and publishes a GitHub Release via gh

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/publish-github-release.yml Outdated
Comment thread .github/workflows/publish-github-release.yml Outdated
Comment thread .github/workflows/publish-github-release.yml Outdated
adamziel and others added 3 commits March 24, 2026 10:45
When we publish packages to npm, people who depend on WordPress Playground
don't have an easy way to find out. GitHub Releases are the standard way to
announce new versions – users can subscribe via Watch → Releases.

This workflow triggers after the changelog update (which itself triggers after
npm publish), reads the version from lerna.json, extracts the matching
CHANGELOG.md section, and creates a GitHub Release with the changelog and
a link to npm. No binary assets are attached.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Creates an empty GitHub Release (no binary downloads) whenever the npm
release workflow succeeds on trunk. The release includes the changelog
section for that version and a link to npm.

Previously this was chained off the Update CHANGELOG.md workflow,
which could trigger from self-hosted releases too – not just npm.
Now it triggers directly off "Release NPM packages" so a GitHub
Release is only created when packages actually ship to npm.
@adamziel adamziel force-pushed the adamziel/gh-release-on-publish branch from 1a9ce4f to 368631e Compare March 24, 2026 16:44
adamziel and others added 2 commits March 24, 2026 18:05
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The CHANGELOG.md headings look like "## [v3.1.13] (2026-03-23)" but
the awk pattern was doing an exact line match against "## [v3.1.13]",
which never matched. Switch to index() prefix matching so the date
suffix is ignored.
@adamziel
Copy link
Copy Markdown
Collaborator Author

CI failures seem completely unrelated. Let's give it a try.

@adamziel adamziel merged commit a2d2a8c into trunk Mar 24, 2026
45 of 47 checks passed
@adamziel adamziel deleted the adamziel/gh-release-on-publish branch March 24, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants