Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow: Fix the issue with npm publishing for WP major version #54088

Merged
merged 1 commit into from Sep 1, 2023

Conversation

gziolo
Copy link
Member

@gziolo gziolo commented Aug 31, 2023

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.

  • Checkout (for CLI) isn't used for wp type so it won't trigger in that case
  • Checkout (for publishing) is now split into two alternative steps, because for wp 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)
  • Setup Node.js is now split into two alternative steps, because for 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 and 6.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.

@gziolo gziolo self-assigned this Aug 31, 2023
@gziolo gziolo added [Type] Bug An existing feature does not function as intended npm Packages Related to npm packages labels Aug 31, 2023
@gziolo
Copy link
Member Author

gziolo commented Aug 31, 2023

I would appreciate some sanity checks for the syntax used in the workflow. I guess I could try to run it from GitHub UI using this branch as a source for the workflow file afterward.

Copy link
Contributor

@tellthemachines tellthemachines left a comment

Choose a reason for hiding this comment

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

Can't say I'm the greatest expert on GH workflows, but these changes make sense to me! We should be publishing packages for the 6.3.2 release soon, so could test if this works then 😄

@gziolo gziolo merged commit 55f85fb into trunk Sep 1, 2023
56 checks passed
@gziolo gziolo deleted the fix/npm-publishing-wp-major branch September 1, 2023 05:23
@github-actions github-actions bot added this to the Gutenberg 16.7 milestone Sep 1, 2023
@gziolo
Copy link
Member Author

gziolo commented Sep 1, 2023

Can't say I'm the greatest expert on GH workflows, but these changes make sense to me! We should be publishing packages for the 6.3.2 release soon, so could test if this works then 😄

I’m usually learning how to fix things on the fly 😅

I trigged npm publishing with the next dist-tag which isn’t rather used by folks. It’s good for testing the workflow: https://github.com/WordPress/gutenberg/actions/runs/6045763772.

@tellthemachines, if everything goes well then feel free to check whether it finally works when targeting WP major 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
npm Packages Related to npm packages [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Packages: Publishing to npm fails for wp/X.Y branches because of older Node.js
2 participants