Skip to content

Improve GHCR asset publishing and expand trigger events to include pull_request#78211

Merged
desrosj merged 3 commits into
trunkfrom
add/publishing-built-assets-for-prs
May 15, 2026
Merged

Improve GHCR asset publishing and expand trigger events to include pull_request#78211
desrosj merged 3 commits into
trunkfrom
add/publishing-built-assets-for-prs

Conversation

@desrosj
Copy link
Copy Markdown
Member

@desrosj desrosj commented May 12, 2026

What?

Expands the publish-to-container-registry job in build-plugin-zip.yml to run on more event types, and publishes a second, mutable tag alongside the existing SHA tag.

Previously the job ran only on push to trunk, release/**, and wp/**. It now also runs on:

  • workflow_dispatch
  • pull_requestonly when the head branch lives in WordPress/gutenberg (fork PRs are explicitly excluded via github.event.pull_request.head.repo.full_name == github.repository)

Every successful publish now produces two tags pointing at the same OCI manifest (added via oras tag, so no duplicated blob storage):

Trigger SHA tag (immutable) Mutable tag
push to trunk <github.sha> trunk
push to release/X.Y <github.sha> release-X.Y
push to wp/X.Y <github.sha> wp-X.Y
workflow_dispatch <github.sha> matches branch
pull_request (internal branch) <pull_request.head.sha> pr-<N>

The SHA tag scheme is unchanged so that https://github.com/WordPress/wordpress-develop/ and any other downstream that pins to gutenberg.sha continues to work without modification.

See WordPress/wordpress-develop#11809 as a companion PR that would add support for this in wordpress-develop.

Why?

There is currently no way to test unmerged changes in the Gutenberg repository in the context of https://github.com/WordPress/wordpress-develop/.

By publishing assets for pull requests, this is now possible. The mutable tag also gives contributors a stable "latest of stream" reference that doesn't require frequent updating of the pinned SHA on every new build. This is especially useful when working on a pull request to ensure the latest changes are present.

How?

This adjusts the workflow logic and makes changes to how the image is tagged through ORAS.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Opus 4.7
Used for: Analysis and initial draft patch.

@desrosj desrosj self-assigned this May 12, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: desrosj <desrosj@git.wordpress.org>
Co-authored-by: westonruter <westonruter@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Comment thread .github/workflows/build-plugin-zip.yml Outdated
Comment thread .github/workflows/build-plugin-zip.yml
Comment on lines +339 to +346
# Add a mutable tag alongside the SHA tag so developers can pull "the latest build for this stream"
# (e.g. :trunk, :pr-12345, :release-19.5) without needing to update a pinned SHA.
- name: Add mutable tag for the built plugin
env:
SOURCE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
MUTABLE_TAG: ${{ steps.mutable_tag.outputs.value }}
run: |
oras tag "ghcr.io/wordpress/gutenberg/gutenberg-wp-develop-build:${SOURCE_SHA}" "${MUTABLE_TAG}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So would the MUTABLE_TAG be usable in gutenberg.sha in the wordpress-develop package.json?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's right! I've created WordPress/wordpress-develop#11809 to show how I picture this working from a consumer standpoint.

Co-Authored-By: Weston Ruter <134745+westonruter@users.noreply.github.com>
@desrosj desrosj requested a review from Copilot May 12, 2026 18:37
@desrosj desrosj added [Type] Build Tooling Issues or PRs related to build tooling GitHub Actions Pull requests that update GitHub Actions code labels May 12, 2026
@desrosj desrosj added the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label May 12, 2026
@github-actions github-actions Bot removed the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label May 12, 2026
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

Updates the build-plugin-zip.yml workflow to publish the wordpress-develop build artifact to GHCR for additional event types (including internal PRs), and to add a mutable “stream” tag alongside the existing immutable SHA tag so downstream consumers can reference “latest for X”.

Changes:

  • Expand publish-to-container-registry to run on workflow_dispatch and internal pull_request events (excluding fork PRs).
  • Use ORAS to push the artifact under a SHA-based tag and then add a second mutable tag derived from branch name or PR number.
  • Record a SOURCE_SHA value in .gutenberg-hash and OCI annotations for PR runs (using the PR head SHA instead of the ephemeral merge SHA).

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

Comment thread .github/workflows/build-plugin-zip.yml
Copy link
Copy Markdown
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

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

Thank you so much for this!

@desrosj desrosj added the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label May 15, 2026
@github-actions github-actions Bot removed the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label May 15, 2026
@desrosj desrosj enabled auto-merge (squash) May 15, 2026 04:47
@desrosj
Copy link
Copy Markdown
Member Author

desrosj commented May 15, 2026

I'm going to merge this once the tests pass to give it a shot! I will commit WordPress/wordpress-develop#11809 tomorrow.

@desrosj desrosj merged commit 123cebb into trunk May 15, 2026
44 checks passed
@desrosj desrosj deleted the add/publishing-built-assets-for-prs branch May 15, 2026 05:16
@github-actions github-actions Bot added this to the Gutenberg 23.3 milestone May 15, 2026
@desrosj desrosj added the Backport to WP 7.0 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label May 15, 2026
desrosj added a commit that referenced this pull request May 15, 2026
…ull_request` (#78211) (#78324)

* Publish assets for pull requests and add mutable tags.

* Remove unnecessary environment variable.

Co-authored-by: westonruter <westonruter@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport to WP 7.0 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta GitHub Actions Pull requests that update GitHub Actions code [Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants