Workflow: Fix the issue with npm publishing for WP major version #54088
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Closes #53628
Follow-up for #53762. My hope was that publishing to npm targeting WP core got resolved by running Lerna directly from GitHub action.
Why?
However, the changes applied didn't work out as expected. I missed the important part that are taken care by the Node.js script we use for all types of publishing – switching to the correct branch in the publish folder. More details in #53762 (comment).
How?
It looks like publishing for the WP major version has an almost completely customized set of steps. That's why I updated the workflow to run most of the steps conditionally to account for it.
wp
type so it won't trigger in that casewp
type we use a different branch (that's a key change which impacts publishing that I missed before as it is handled by the script in other cases)wp
type we want to use npm version defined in the release branch (I missed that before as it is handled by the script in other cases)Testing instruction
I don't know what would be the best way to test it without merging. It should just work the next time we have to publish npm packages for WordPress 6.4.x minor release following the instructions:
https://github.com/WordPress/gutenberg/blob/trunk/docs/contributors/code/release.md#wordpress-releases
One way to test it after merging, would be triggering an action with
wp
type and6.3
version. It doesn't have any changes at the moment, so the script should just run and report that there are no changes to publish.