Publish built Gutenberg plugin to the GitHub Container Registry#75844
Publish built Gutenberg plugin to the GitHub Container Registry#75844
Conversation
|
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. |
|
Size Change: 0 B Total Size: 6.89 MB ℹ️ View Unchanged
|
|
Flaky tests detected in 1bbed3c. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22770135247
|
|
This is good to go! I am unsure how to resolve the remaining linting issues. It tells me to make use of a variable that is being set in the lines being flagged. Also unsure why issues within unedited files are being returned as well. |
dmsnell
left a comment
There was a problem hiding this comment.
There was a lot of work exploring how to get here, how to build this, and how to work through the issues. Thank you for spending so much energy on it.
There seem to be no major or blocking issues, and the reduction in network demand and CPU demand when building WordPress, that this provides, should bring a dramatic improvement on CI times and for local development.
Anything else is great for future work, optimization, refactoring.
This adds a job to the Build Gutenberg Plugin Zip workflow that publishes the built zip to the GitHub Container Registry.
The organization and repository names cannot have capital letters. Since the conditionals ensure the job only runs in the WordPress/gutenberg repository, this value can be safely hard-coded.
Because the `wp-build` package performs some substitutions, the script needs to be run with `IS_GUTENBERG_PLUGIN` set to `false` an `IS_WORDPRESS_CORE` set to `true`.
# This is the 1st commit message: Publish the built plugin zip. This adds a job to the Build Gutenberg Plugin Zip workflow that publishes the built zip to the GitHub Container Registry. # This is the commit message #2: `always()` check is necessary. # This is the commit message #3: Don't use arrays for `include` combinations. # This is the commit message #4: Adjust job names so it's clear what's being done. This ensures the "Build Release Artifact" name is preserved when the assets are built for the Gutenberg plugin because that is a check that is required to be passing before a merge is allowed. # This is the commit message #5: Correct typo in environment variable. # This is the commit message #6: One more typo fix.
This adds a job to the Build Gutenberg Plugin Zip workflow that publishes the built zip to the GitHub Container Registry.
# This is the 1st commit message: Change the package name to be more specific. # This is the commit message #2: Change the package name on GHCR. Even though it's nested under the `gutenberg` repository, `wordpress-develop-build` could be confusing. # This is the commit message #3: Correct other relevant conditionals. # This is the commit message #4: Workflow file can be simplified now. With better type casting to avoid truthy false values, the workflow can be less cautious. # This is the commit message #5: Fix one missed conditional.
Co-Authored-By: Dennis Snell <dennis.snell@automattic.com>
This allows the plugin name setting to be overridden more easily so that GitHub Actions can change the behavior of the build package.
This allows the plugin name setting to be overridden more easily so that GitHub Actions can change the behavior of the build package.
# This is the 1st commit message: Allow plugin name to be overridden. This allows the plugin name setting to be overridden more easily so that GitHub Actions can change the behavior of the build package. # This is the commit message #2: Support `wpPlugin.name` without env variables # This is the commit message #3: Ensure boolean casting is more reliable. # This is the commit message #4: Remove debug line.
This allows the plugin name setting to be overridden more easily so that GitHub Actions can change the behavior of the build package.
|
I spoke briefly with @youknowriad today and while he did not get to thoroughly review this, he mentioned the only thing that he did not love was adding support for a new I've gone and removed that. It's a one-line |
|
There was a conflict while trying to cherry-pick the commit to the wp/7.0 branch. Please resolve the conflict manually and create a PR to the wp/7.0 branch. PRs to wp/7.0 are similar to PRs to trunk, but you should base your PR on the wp/7.0 branch instead of trunk. |
* Publish the built plugin zip. This adds a job to the Build Gutenberg Plugin Zip workflow that publishes the built zip to the GitHub Container Registry. * `always()` check is necessary. * Do not attempt to publish to GHCR in forks. * Hardcode the org/repository. The organization and repository names cannot have capital letters. Since the conditionals ensure the job only runs in the WordPress/gutenberg repository, this value can be safely hard-coded. * Prepare a plugin artifact for `wordpress-develop` Because the `wp-build` package performs some substitutions, the script needs to be run with `IS_GUTENBERG_PLUGIN` set to `false` an `IS_WORDPRESS_CORE` set to `true`. * # This is a combination of 6 commits. Publish the built plugin zip. This adds a job to the Build Gutenberg Plugin Zip workflow that publishes the built zip to the GitHub Container Registry. `always()` check is necessary. Don't use arrays for `include` combinations. Adjust job names so it's clear what's being done. This ensures the "Build Release Artifact" name is preserved when the assets are built for the Gutenberg plugin because that is a check that is required to be passing before a merge is allowed. Correct typo in environment variable. One more typo fix. * Publish the built plugin zip. This adds a job to the Build Gutenberg Plugin Zip workflow that publishes the built zip to the GitHub Container Registry. * # This is a combination of 5 commits. Change the package name to be more specific. Change the package name on GHCR. Even though it's nested under the `gutenberg` repository, `wordpress-develop-build` could be confusing. Correct other relevant conditionals. Workflow file can be simplified now. With better type casting to avoid truthy false values, the workflow can be less cautious. Fix one missed conditional. * Make the package name more specific. Co-Authored-By: Dennis Snell <dennis.snell@automattic.com> * Allow plugin name to be overridden. This allows the plugin name setting to be overridden more easily so that GitHub Actions can change the behavior of the build package. * Allow plugin name to be overridden. This allows the plugin name setting to be overridden more easily so that GitHub Actions can change the behavior of the build package. * # This is a combination of 4 commits. Allow plugin name to be overridden. This allows the plugin name setting to be overridden more easily so that GitHub Actions can change the behavior of the build package. Support `wpPlugin.name` without env variables Ensure boolean casting is more reliable. Remove debug line. * Allow plugin name to be overridden. This allows the plugin name setting to be overridden more easily so that GitHub Actions can change the behavior of the build package. * Make the default `base-url` value context aware. * Allow relevant values to be overridden more easily * Skip PHP transforms when building for WP Core. * Document environment variable in README. * Improve utility function name and inline docs. * Update CHANGELOG. * Account for more truthy values in `castBool` * Remove unrelated change. Co-Authored-By: Dennis Snell <dennis.snell@automattic.com> * Add a description to the ORAS step. Co-Authored-By: Dennis Snell <dennis.snell@automattic.com> * Switch to using `.gz` over `.zip`. Co-Authored-By: Dennis Snell <dennis.snell@automattic.com> Push some debug code. Co-Authored-By: Dennis Snell <dennis.snell@automattic.com> Make corrections to new compression steps. Change directory to compress. Avoid `tar` writing to itself. Unzip GitHub artifact. Zip files are rezipped by upload-artifact. Relax repo specific rules Debugging. Adjust. More changes. Remove debug code. * Improvements to the boolean casting function. Co-Authored-By: Dennis Snell <dennis.snell@automattic.com> * Final coding standards fixes. * Remove stray unnecessary `eslint-enable`. * Remove the `WP_PLUGIN_NAME` env variable. This eliminates an environment variable that's essentially only present to facilitate builds for `wordpress-develop`. --------- Co-authored-by: desrosj <desrosj@git.wordpress.org> Co-authored-by: dmsnell <dmsnell@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
|
There was a conflict while trying to cherry-pick the commit to the wp/7.0 branch. Please resolve the conflict manually and create a PR to the wp/7.0 branch. PRs to wp/7.0 are similar to PRs to trunk, but you should base your PR on the wp/7.0 branch instead of trunk. |
1 similar comment
|
There was a conflict while trying to cherry-pick the commit to the wp/7.0 branch. Please resolve the conflict manually and create a PR to the wp/7.0 branch. PRs to wp/7.0 are similar to PRs to trunk, but you should base your PR on the wp/7.0 branch instead of trunk. |
…) (#76273) * Publish the built plugin zip. This adds a job to the Build Gutenberg Plugin Zip workflow that publishes the built zip to the GitHub Container Registry. * `always()` check is necessary. * Do not attempt to publish to GHCR in forks. * Hardcode the org/repository. The organization and repository names cannot have capital letters. Since the conditionals ensure the job only runs in the WordPress/gutenberg repository, this value can be safely hard-coded. * Prepare a plugin artifact for `wordpress-develop` Because the `wp-build` package performs some substitutions, the script needs to be run with `IS_GUTENBERG_PLUGIN` set to `false` an `IS_WORDPRESS_CORE` set to `true`. * # This is a combination of 6 commits. Publish the built plugin zip. This adds a job to the Build Gutenberg Plugin Zip workflow that publishes the built zip to the GitHub Container Registry. `always()` check is necessary. Don't use arrays for `include` combinations. Adjust job names so it's clear what's being done. This ensures the "Build Release Artifact" name is preserved when the assets are built for the Gutenberg plugin because that is a check that is required to be passing before a merge is allowed. Correct typo in environment variable. One more typo fix. * Publish the built plugin zip. This adds a job to the Build Gutenberg Plugin Zip workflow that publishes the built zip to the GitHub Container Registry. * # This is a combination of 5 commits. Change the package name to be more specific. Change the package name on GHCR. Even though it's nested under the `gutenberg` repository, `wordpress-develop-build` could be confusing. Correct other relevant conditionals. Workflow file can be simplified now. With better type casting to avoid truthy false values, the workflow can be less cautious. Fix one missed conditional. * Make the package name more specific. * Allow plugin name to be overridden. This allows the plugin name setting to be overridden more easily so that GitHub Actions can change the behavior of the build package. * Allow plugin name to be overridden. This allows the plugin name setting to be overridden more easily so that GitHub Actions can change the behavior of the build package. * # This is a combination of 4 commits. Allow plugin name to be overridden. This allows the plugin name setting to be overridden more easily so that GitHub Actions can change the behavior of the build package. Support `wpPlugin.name` without env variables Ensure boolean casting is more reliable. Remove debug line. * Allow plugin name to be overridden. This allows the plugin name setting to be overridden more easily so that GitHub Actions can change the behavior of the build package. * Make the default `base-url` value context aware. * Allow relevant values to be overridden more easily * Skip PHP transforms when building for WP Core. * Document environment variable in README. * Improve utility function name and inline docs. * Update CHANGELOG. * Account for more truthy values in `castBool` * Remove unrelated change. * Add a description to the ORAS step. * Switch to using `.gz` over `.zip`. Push some debug code. Make corrections to new compression steps. Change directory to compress. Avoid `tar` writing to itself. Unzip GitHub artifact. Zip files are rezipped by upload-artifact. Relax repo specific rules Debugging. Adjust. More changes. Remove debug code. * Improvements to the boolean casting function. * Final coding standards fixes. * Remove stray unnecessary `eslint-enable`. * Remove the `WP_PLUGIN_NAME` env variable. This eliminates an environment variable that's essentially only present to facilitate builds for `wordpress-develop`. --------- Co-authored-by: desrosj <desrosj@git.wordpress.org> Co-authored-by: dmsnell <dmsnell@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
This updates the pinned hash from the `gutenberg` from `f4d8a5803aa2fbe26e7d9af4d17e80a622b7bab8` to `7b7fa2bc97a8029a302bd6511cf0d206b5953172`. The following changes are included: - Sort registry files by handle/ID. (WordPress/gutenberg#75755) - Obey undoIgnore flag in editEntityRecord (WordPress/gutenberg#76206) - RTC: Fix `post-editor-template-mode` E2E test (WordPress/gutenberg#76209) - Publish built Gutenberg plugin to the GitHub Container Registry (WordPress/gutenberg#75844) (WordPress/gutenberg#76273) - Connectors: Improve placeholder text and make it translatable (WordPress/gutenberg#75996) - Block context menu: context menu not closing for disconnecting unsynced pattern menu items (WordPress/gutenberg#75405) - Connectors: Improve responsive layout for small viewports (WordPress/gutenberg#76231) - theme.json schema: fix pseudo-class definition for button block (WordPress/gutenberg#76272) - Navigation block: fix submenu chevron toggle on touch devices (WordPress/gutenberg#76197) See #64595, #64393. git-svn-id: https://develop.svn.wordpress.org/trunk@61868 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned hash from the `gutenberg` from `f4d8a5803aa2fbe26e7d9af4d17e80a622b7bab8` to `7b7fa2bc97a8029a302bd6511cf0d206b5953172`. The following changes are included: - Sort registry files by handle/ID. (WordPress/gutenberg#75755) - Obey undoIgnore flag in editEntityRecord (WordPress/gutenberg#76206) - RTC: Fix `post-editor-template-mode` E2E test (WordPress/gutenberg#76209) - Publish built Gutenberg plugin to the GitHub Container Registry (WordPress/gutenberg#75844) (WordPress/gutenberg#76273) - Connectors: Improve placeholder text and make it translatable (WordPress/gutenberg#75996) - Block context menu: context menu not closing for disconnecting unsynced pattern menu items (WordPress/gutenberg#75405) - Connectors: Improve responsive layout for small viewports (WordPress/gutenberg#76231) - theme.json schema: fix pseudo-class definition for button block (WordPress/gutenberg#76272) - Navigation block: fix submenu chevron toggle on touch devices (WordPress/gutenberg#76197) See #64595, #64393. Built from https://develop.svn.wordpress.org/trunk@61868 git-svn-id: http://core.svn.wordpress.org/trunk@61155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In #76038, code was added to exclude experimental pages when building for WordPress Core. The code merged in #75844 did not adjust this code to detect the environment variable `IS_WORDPRESS_CORE` before `npm_package_config_IS_WORDPRESS_CORE`. Co-authored-by: desrosj <desrosj@git.wordpress.org> Co-authored-by: dmsnell <dmsnell@git.wordpress.org>
In #76038, code was added to exclude experimental pages when building for WordPress Core. The code merged in #75844 did not adjust this code to detect the environment variable `IS_WORDPRESS_CORE` before `npm_package_config_IS_WORDPRESS_CORE`. Co-authored-by: desrosj <desrosj@git.wordpress.org> Co-authored-by: dmsnell <dmsnell@git.wordpress.org>
This iterates on the changes from [61438] by removing the need to: - Check out the WordPress/gutenberg repository at the pinned hash. - Run `npm install` within that checkout. - Run `npm build` within that checkout. Instead, the build script will now download a prebuilt zip file published to the GitHub Container Registry by a GitHub Actions workflow recently merged to the Gutenberg Repository (related PR: WordPress/gutenberg#75844). This also removes redundant code responsible for: - Copying files from the `gutenberg` directory to the appropriate locations during the build script in favor of using `grunt copy`. - Modifying built files to replace specific text, such as `sourceMappingURL`, in favor of `grunt replace`. The remaining files within the `tools/gutenberg` directory have been renamed to remove `gutenberg` from the file names. Since these are already nested in a `gutenberg` directory, that was redundant. Since the intention of the pinned value for the repository in the `package.json` file is to specify a full-length commit hash, `ref` has been renamed to `sha`. In Git `ref` encompasses branches, tags, and commit hashes, so this hopefully makes it more clear that something like `branch-name` should not be used. Follow up to [61438], [61439], [61458], [61492], [61677], [61867]. Props desrosj, dmsnell, westonruter, mcsf, jorbin. See #64393. git-svn-id: https://develop.svn.wordpress.org/trunk@61873 602fd350-edb4-49c9-b593-d223f7449a82
|
I came here just to say thank you for taking this simpler approach to the Gutenberg integration with wordpress-develop 👍 |
This iterates on the changes from [61438] by removing the need to: - Check out the WordPress/gutenberg repository at the pinned hash. - Run `npm install` within that checkout. - Run `npm build` within that checkout. Instead, the build script will now download a prebuilt zip file published to the GitHub Container Registry by a GitHub Actions workflow recently merged to the Gutenberg Repository (related PR: WordPress/gutenberg#75844). This also removes redundant code responsible for: - Copying files from the `gutenberg` directory to the appropriate locations during the build script in favor of using `grunt copy`. - Modifying built files to replace specific text, such as `sourceMappingURL`, in favor of `grunt replace`. The remaining files within the `tools/gutenberg` directory have been renamed to remove `gutenberg` from the file names. Since these are already nested in a `gutenberg` directory, that was redundant. Since the intention of the pinned value for the repository in the `package.json` file is to specify a full-length commit hash, `ref` has been renamed to `sha`. In Git `ref` encompasses branches, tags, and commit hashes, so this hopefully makes it more clear that something like `branch-name` should not be used. Follow up to [61438], [61439], [61458], [61492], [61677], [61867]. Props desrosj, dmsnell, westonruter, mcsf, jorbin. See #64393. Built from https://develop.svn.wordpress.org/trunk@61873 git-svn-id: http://core.svn.wordpress.org/trunk@61159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
When this ran on the latest Gutenberg RC it created an error: https://github.com/WordPress/gutenberg/actions/runs/22948854578.
I guess we should allow the other jobs to run even if this fails. I'm not sure why the artifact already exists though... |
|
I think I see the issue: As of this PR, there's a strategy matrix (with either gutenberg/.github/workflows/build-plugin-zip.yml Lines 230 to 234 in 5740956 ... but not for the release notes: gutenberg/.github/workflows/build-plugin-zip.yml Lines 252 to 257 in 5740956 This means that when the Since the release notes are only required for the GB plugin release (and not for the WP Core sync, AFAIK), we can probably just add a condition to skip it based on that criterion. I'll file a PR. |
What?
This is part 1 of 2 for an alternative approach to the changes in r61438.
This adds a job to the Build Gutenberg Plugin Zip workflow that publishes a built zip file to the GitHub Container Registry for easy consumption by https://github.com/WordPress/wordpress-develop/.
Why?
This helps to eliminates the cloning the Gutenberg full repository before installing all the required dependencies and running the build script within https://github.com/WordPress/wordpress-develop/ as a requirement for merging updates into WP Core.
How?
While the workflow already stores the built plugin zip as an artifact, artifacts are difficult to retrieve without knowing specific information or making several GH API calls. Artifacts are also stored for a maximum of 90 days.
Using ORAS (OCI Registry As Storage), the GitHub Container Registry can store arbitrary files instead of container images. Packages published to GHCR are stored indefinitely. While tags are typically used for semver versioning, they can easily be used to tag a package with any string (such as a commit hash).
There are conditional statements in place within the workflow to prevent publishing containers on forks, and only
pushevents will publish containers.Some other notes:
WP_PLUGIN_NAME, has been introduced to allowwpPlugin.nameto be changed without having to update thepackage.jsonfile. This is particularly useful within CI/CD workflows.falseand0do not evaluate as Booleantrue. This can result in the script running incorrectly whenIS_GUTENBERG_PLUGINis defined as"false"in thepackage.jsonfile.Testing Instructions
This PR published a test package to the GHCR under the name
gutenberg-build. Going forward, onlypushevents will publish to the GHCR.This should be tested within the companion pull request on
wordpress-develop, which has been updated to make use of the published package on the GHCR.AI Usage
Claude Code was used pretty heavily to analyze the
wp-buildpackage and provide a summary to understand it more quickly, and to debug problems related to unexpected typecasting results.