Skip to content

Conversation

@youknowriad
Copy link
Contributor

Related #72032

What

I noticed that the scripts auto-registration relied on a plugin version that is gutenberg specific. The build tool itself is meant to be plugin agnostic so this PR injects the version during build time. I also noticed that we already had a build tool that we only run during plugin release that did the same, so I removed that one and consolidated in the default build tool.

Testing Instructions

E2E tests should pass (scripts are used everywhere)

@youknowriad youknowriad requested a review from aduth October 27, 2025 13:51
@youknowriad youknowriad self-assigned this Oct 27, 2025
@youknowriad youknowriad added the [Type] Build Tooling Issues or PRs related to build tooling label Oct 27, 2025
@github-actions
Copy link

github-actions bot commented Oct 27, 2025

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: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: iqbal-web <iqbal1hossain@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>

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

@github-actions
Copy link

github-actions bot commented Oct 27, 2025

Flaky tests detected in 88b6f5a.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18866198976
📝 Reported issues:

/**
* Generate PHP file for version constant.
*/
async function generateVersionPhp() {
Copy link
Member

Choose a reason for hiding this comment

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

There's a lot of duplication between this and generateScriptRegistrationPhp. Maybe we should generalize a function for writing a file from a template with a given set of variables? (maybe some default variables)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed :) I'm planning to do some kind of cleanup PR to make things more digestible in the build tool.


$git_commit = trim( shell_exec( 'git rev-parse HEAD' ) );

echo "define( 'GUTENBERG_GIT_COMMIT', '$git_commit' );\n";
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to preserve this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't see it used anywhere.

@youknowriad youknowriad enabled auto-merge (squash) October 28, 2025 06:34
@youknowriad youknowriad merged commit 216fa87 into trunk Oct 28, 2025
34 checks passed
@youknowriad youknowriad deleted the update/gutenberg-version-generation branch October 28, 2025 07:07
@github-actions github-actions bot added this to the Gutenberg 22.0 milestone Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants