Improve GHCR asset publishing and expand trigger events to include pull_request#78211
Improve GHCR asset publishing and expand trigger events to include pull_request#78211desrosj wants to merge 2 commits into
pull_request#78211Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
| # 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}" |
There was a problem hiding this comment.
So would the MUTABLE_TAG be usable in gutenberg.sha in the wordpress-develop package.json?
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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-registryto run onworkflow_dispatchand internalpull_requestevents (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_SHAvalue in.gutenberg-hashand 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.
westonruter
left a comment
There was a problem hiding this comment.
Thank you so much for this!
What?
Expands the
publish-to-container-registryjob inbuild-plugin-zip.ymlto run on more event types, and publishes a second, mutable tag alongside the existing SHA tag.Previously the job ran only on
pushtotrunk,release/**, andwp/**. It now also runs on:workflow_dispatchpull_request— only when the head branch lives inWordPress/gutenberg(fork PRs are explicitly excluded viagithub.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):pushtotrunk<github.sha>trunkpushtorelease/X.Y<github.sha>release-X.Ypushtowp/X.Y<github.sha>wp-X.Yworkflow_dispatch<github.sha>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.shacontinues 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.