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

GitHub Actions: Create Release Draft when tagging version #27488

Merged
merged 15 commits into from
Jan 11, 2021

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Dec 3, 2020

Description

Second stab at writing a workflow (GitHub action) to build Gutenberg upon creating a tag that starts with v, and creating a draft release with the build attached to it. Supersedes #19626.

The difference to #19626 is that:

  • the release creation is now done in a separate job, and the plugin zip is retained as an artifact, and
  • the release notes are extracted from the Changelog.

The (locally run) release script works pretty much as before -- only plugin zip creation and GitHub release creation have been removed (since they're now done by the new workflow).

Note that we're currently creating a release draft, meaning an extra step is required to publish the release: Clicking the 'Publish' button. While I find that extra safety net convenient, it is mainly for testing purposes. I'm happy to change it to publish the release right away -- it's only a one-line change (plus a few instructions in the release scripts).

The new GH workflow uses the following GH actions:

The main benefit of this PR is that the plugin build is decoupled from people's local systems and setups, yielding reproducible builds, and cutting down time spent running the release process locally (freeing up people's systems earlier). (One micro-optimization is e.g. that it's no longer necessary to enter a GH access token during the release process.)

How has this been tested?

See here for an example release draft created by this action: https://github.com/ockham/gutenberg/releases/tag/untagged-f7f779e5825df118d22c

Corresponding workflow run: https://github.com/ockham/gutenberg/runs/1670519325?check_suite_focus=true

Or use the following instructions to test for yourself:

  • Make sure you have your own fork of the Gutenberg repo, and that you've added it locally as a remote (E.g. git remote add ockham git@github.com:ockham/gutenberg.git if your GH username is ockham 🙂 ).
  • Check out this PR's branch, and push the contents to your fork's master branch (you can reset later):
git push ockham add/gh-action-create-release:master
  • Note the latest GB plugin release version (9.7.0 at the time of this writing).
  • Delete the corresponding tag both locally (e.g. git tag -d v9.7.0) and in your fork git push ockham :v9.7.0.
  • Recreate the tag, e.g. git tag v9.7.0.
  • Push that tag to your fork: git push --tags ockham.
  • Go to the 'Actions' tab of your fork's GH page (e.g. https://github.com/ockham/gutenberg/actions).
  • Locate the action whose description reads "Build Gutenberg and upload to Draft Release", and click on it.
  • It should take less than 5 minutes to build the plugin zip. You can watch that page as the action progresses.
  • Eventually, a release draft will be created, and the plugin zip will be attached. You'll find it under 'Releases' (e.g. https://github.com/ockham/gutenberg/releases)
  • Don't forget to clean up tags after running these commands, so you won't accidentally push tags that you solely created for testing to the actual Gutenberg repo later. See e.g. https://stackoverflow.com/questions/1841341/remove-local-git-tags-that-are-no-longer-on-the-remote-repository

(I've used my Gutenberg fork as an example, you can see the relevant action and release drafts from previous runs there.)

Alternatively, you can also use the local release script to create the tag and changelog. Make sure to modify bin/plugin/config.js to point to your forked repo!

Types of changes

Build tools automation

@ockham ockham added the [Type] Build Tooling Issues or PRs related to build tooling label Dec 3, 2020
@ockham ockham self-assigned this Dec 3, 2020
@github-actions
Copy link

github-actions bot commented Dec 3, 2020

Size Change: -26 B (0%)

Total Size: 1.3 MB

Filename Size Change
build/block-library/index.js 151 kB +5 B (0%)
build/components/index.js 172 kB -31 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.8 kB 0 B
build/api-fetch/index.js 3.42 kB 0 B
build/autop/index.js 2.83 kB 0 B
build/blob/index.js 664 B 0 B
build/block-directory/index.js 9.04 kB 0 B
build/block-directory/style-rtl.css 1.01 kB 0 B
build/block-directory/style.css 1.01 kB 0 B
build/block-editor/index.js 130 kB 0 B
build/block-editor/style-rtl.css 11.4 kB 0 B
build/block-editor/style.css 11.3 kB 0 B
build/block-library/blocks/archives/editor-rtl.css 196 B 0 B
build/block-library/blocks/archives/editor.css 196 B 0 B
build/block-library/blocks/audio/editor-rtl.css 194 B 0 B
build/block-library/blocks/audio/editor.css 194 B 0 B
build/block-library/blocks/audio/style-rtl.css 225 B 0 B
build/block-library/blocks/audio/style.css 225 B 0 B
build/block-library/blocks/block/editor-rtl.css 283 B 0 B
build/block-library/blocks/block/editor.css 283 B 0 B
build/block-library/blocks/button/editor-rtl.css 576 B 0 B
build/block-library/blocks/button/editor.css 577 B 0 B
build/block-library/blocks/button/style-rtl.css 552 B 0 B
build/block-library/blocks/button/style.css 552 B 0 B
build/block-library/blocks/buttons/editor-rtl.css 345 B 0 B
build/block-library/blocks/buttons/editor.css 346 B 0 B
build/block-library/blocks/buttons/style-rtl.css 419 B 0 B
build/block-library/blocks/buttons/style.css 419 B 0 B
build/block-library/blocks/calendar/style-rtl.css 319 B 0 B
build/block-library/blocks/calendar/style.css 319 B 0 B
build/block-library/blocks/categories/editor-rtl.css 210 B 0 B
build/block-library/blocks/categories/editor.css 209 B 0 B
build/block-library/blocks/categories/style-rtl.css 208 B 0 B
build/block-library/blocks/categories/style.css 208 B 0 B
build/block-library/blocks/code/style-rtl.css 216 B 0 B
build/block-library/blocks/code/style.css 216 B 0 B
build/block-library/blocks/columns/editor-rtl.css 300 B 0 B
build/block-library/blocks/columns/editor.css 299 B 0 B
build/block-library/blocks/columns/style-rtl.css 529 B 0 B
build/block-library/blocks/columns/style.css 528 B 0 B
build/block-library/blocks/cover/editor-rtl.css 508 B 0 B
build/block-library/blocks/cover/editor.css 506 B 0 B
build/block-library/blocks/cover/style-rtl.css 1.33 kB 0 B
build/block-library/blocks/cover/style.css 1.32 kB 0 B
build/block-library/blocks/embed/editor-rtl.css 594 B 0 B
build/block-library/blocks/embed/editor.css 595 B 0 B
build/block-library/blocks/embed/style-rtl.css 489 B 0 B
build/block-library/blocks/embed/style.css 489 B 0 B
build/block-library/blocks/file/editor-rtl.css 314 B 0 B
build/block-library/blocks/file/editor.css 313 B 0 B
build/block-library/blocks/file/style-rtl.css 352 B 0 B
build/block-library/blocks/file/style.css 352 B 0 B
build/block-library/blocks/freeform/editor-rtl.css 2.55 kB 0 B
build/block-library/blocks/freeform/editor.css 2.55 kB 0 B
build/block-library/blocks/gallery/editor-rtl.css 749 B 0 B
build/block-library/blocks/gallery/editor.css 750 B 0 B
build/block-library/blocks/gallery/style-rtl.css 1.17 kB 0 B
build/block-library/blocks/gallery/style.css 1.17 kB 0 B
build/block-library/blocks/group/editor-rtl.css 433 B 0 B
build/block-library/blocks/group/editor.css 432 B 0 B
build/block-library/blocks/group/style-rtl.css 190 B 0 B
build/block-library/blocks/group/style.css 190 B 0 B
build/block-library/blocks/heading/editor-rtl.css 248 B 0 B
build/block-library/blocks/heading/editor.css 248 B 0 B
build/block-library/blocks/heading/style-rtl.css 212 B 0 B
build/block-library/blocks/heading/style.css 212 B 0 B
build/block-library/blocks/html/editor-rtl.css 384 B 0 B
build/block-library/blocks/html/editor.css 385 B 0 B
build/block-library/blocks/image/editor-rtl.css 801 B 0 B
build/block-library/blocks/image/editor.css 800 B 0 B
build/block-library/blocks/image/style-rtl.css 569 B 0 B
build/block-library/blocks/image/style.css 570 B 0 B
build/block-library/blocks/latest-comments/editor-rtl.css 277 B 0 B
build/block-library/blocks/latest-comments/editor.css 275 B 0 B
build/block-library/blocks/latest-comments/style-rtl.css 382 B 0 B
build/block-library/blocks/latest-comments/style.css 382 B 0 B
build/block-library/blocks/latest-posts/editor-rtl.css 254 B 0 B
build/block-library/blocks/latest-posts/editor.css 254 B 0 B
build/block-library/blocks/latest-posts/style-rtl.css 634 B 0 B
build/block-library/blocks/latest-posts/style.css 634 B 0 B
build/block-library/blocks/list/editor-rtl.css 203 B 0 B
build/block-library/blocks/list/editor.css 203 B 0 B
build/block-library/blocks/list/style-rtl.css 201 B 0 B
build/block-library/blocks/list/style.css 201 B 0 B
build/block-library/blocks/media-text/editor-rtl.css 311 B 0 B
build/block-library/blocks/media-text/editor.css 311 B 0 B
build/block-library/blocks/media-text/style-rtl.css 642 B 0 B
build/block-library/blocks/media-text/style.css 640 B 0 B
build/block-library/blocks/more/editor-rtl.css 545 B 0 B
build/block-library/blocks/more/editor.css 545 B 0 B
build/block-library/blocks/navigation-link/editor-rtl.css 503 B 0 B
build/block-library/blocks/navigation-link/editor.css 504 B 0 B
build/block-library/blocks/navigation-link/style-rtl.css 805 B 0 B
build/block-library/blocks/navigation-link/style.css 803 B 0 B
build/block-library/blocks/navigation/editor-rtl.css 1.38 kB 0 B
build/block-library/blocks/navigation/editor.css 1.38 kB 0 B
build/block-library/blocks/navigation/style-rtl.css 274 B 0 B
build/block-library/blocks/navigation/style.css 274 B 0 B
build/block-library/blocks/nextpage/editor-rtl.css 507 B 0 B
build/block-library/blocks/nextpage/editor.css 507 B 0 B
build/block-library/blocks/paragraph/editor-rtl.css 236 B 0 B
build/block-library/blocks/paragraph/editor.css 236 B 0 B
build/block-library/blocks/paragraph/style-rtl.css 351 B 0 B
build/block-library/blocks/paragraph/style.css 352 B 0 B
build/block-library/blocks/post-author/editor-rtl.css 329 B 0 B
build/block-library/blocks/post-author/editor.css 329 B 0 B
build/block-library/blocks/post-author/style-rtl.css 303 B 0 B
build/block-library/blocks/post-author/style.css 303 B 0 B
build/block-library/blocks/post-comments-form/style-rtl.css 358 B 0 B
build/block-library/blocks/post-comments-form/style.css 358 B 0 B
build/block-library/blocks/post-content/editor-rtl.css 262 B 0 B
build/block-library/blocks/post-content/editor.css 262 B 0 B
build/block-library/blocks/post-excerpt/editor-rtl.css 206 B 0 B
build/block-library/blocks/post-excerpt/editor.css 206 B 0 B
build/block-library/blocks/post-featured-image/editor-rtl.css 453 B 0 B
build/block-library/blocks/post-featured-image/editor.css 453 B 0 B
build/block-library/blocks/post-featured-image/style-rtl.css 223 B 0 B
build/block-library/blocks/post-featured-image/style.css 223 B 0 B
build/block-library/blocks/preformatted/style-rtl.css 193 B 0 B
build/block-library/blocks/preformatted/style.css 193 B 0 B
build/block-library/blocks/pullquote/editor-rtl.css 304 B 0 B
build/block-library/blocks/pullquote/editor.css 304 B 0 B
build/block-library/blocks/pullquote/style-rtl.css 428 B 0 B
build/block-library/blocks/pullquote/style.css 428 B 0 B
build/block-library/blocks/query-loop/editor-rtl.css 217 B 0 B
build/block-library/blocks/query-loop/editor.css 216 B 0 B
build/block-library/blocks/query-loop/style-rtl.css 427 B 0 B
build/block-library/blocks/query-loop/style.css 429 B 0 B
build/block-library/blocks/query/editor-rtl.css 279 B 0 B
build/block-library/blocks/query/editor.css 279 B 0 B
build/block-library/blocks/quote/editor-rtl.css 195 B 0 B
build/block-library/blocks/quote/editor.css 195 B 0 B
build/block-library/blocks/quote/style-rtl.css 284 B 0 B
build/block-library/blocks/quote/style.css 285 B 0 B
build/block-library/blocks/rss/editor-rtl.css 307 B 0 B
build/block-library/blocks/rss/editor.css 309 B 0 B
build/block-library/blocks/rss/style-rtl.css 394 B 0 B
build/block-library/blocks/rss/style.css 393 B 0 B
build/block-library/blocks/search/editor-rtl.css 285 B 0 B
build/block-library/blocks/search/editor.css 285 B 0 B
build/block-library/blocks/search/style-rtl.css 454 B 0 B
build/block-library/blocks/search/style.css 456 B 0 B
build/block-library/blocks/separator/editor-rtl.css 229 B 0 B
build/block-library/blocks/separator/editor.css 229 B 0 B
build/block-library/blocks/separator/style-rtl.css 352 B 0 B
build/block-library/blocks/separator/style.css 352 B 0 B
build/block-library/blocks/shortcode/editor-rtl.css 603 B 0 B
build/block-library/blocks/shortcode/editor.css 603 B 0 B
build/block-library/blocks/site-logo/editor-rtl.css 321 B 0 B
build/block-library/blocks/site-logo/editor.css 321 B 0 B
build/block-library/blocks/site-logo/style-rtl.css 238 B 0 B
build/block-library/blocks/site-logo/style.css 238 B 0 B
build/block-library/blocks/social-link/editor-rtl.css 283 B 0 B
build/block-library/blocks/social-link/editor.css 283 B 0 B
build/block-library/blocks/social-links/editor-rtl.css 811 B 0 B
build/block-library/blocks/social-links/editor.css 810 B 0 B
build/block-library/blocks/social-links/style-rtl.css 1.44 kB 0 B
build/block-library/blocks/social-links/style.css 1.44 kB 0 B
build/block-library/blocks/spacer/editor-rtl.css 390 B 0 B
build/block-library/blocks/spacer/editor.css 390 B 0 B
build/block-library/blocks/spacer/style-rtl.css 184 B 0 B
build/block-library/blocks/spacer/style.css 184 B 0 B
build/block-library/blocks/subhead/editor-rtl.css 223 B 0 B
build/block-library/blocks/subhead/editor.css 223 B 0 B
build/block-library/blocks/subhead/style-rtl.css 210 B 0 B
build/block-library/blocks/subhead/style.css 210 B 0 B
build/block-library/blocks/table/editor-rtl.css 593 B 0 B
build/block-library/blocks/table/editor.css 593 B 0 B
build/block-library/blocks/table/style-rtl.css 501 B 0 B
build/block-library/blocks/table/style.css 501 B 0 B
build/block-library/blocks/tag-cloud/editor-rtl.css 237 B 0 B
build/block-library/blocks/tag-cloud/editor.css 235 B 0 B
build/block-library/blocks/tag-cloud/style-rtl.css 221 B 0 B
build/block-library/blocks/tag-cloud/style.css 221 B 0 B
build/block-library/blocks/template-part/editor-rtl.css 714 B 0 B
build/block-library/blocks/template-part/editor.css 714 B 0 B
build/block-library/blocks/text-columns/editor-rtl.css 220 B 0 B
build/block-library/blocks/text-columns/editor.css 220 B 0 B
build/block-library/blocks/text-columns/style-rtl.css 283 B 0 B
build/block-library/blocks/text-columns/style.css 283 B 0 B
build/block-library/blocks/verse/editor-rtl.css 194 B 0 B
build/block-library/blocks/verse/editor.css 194 B 0 B
build/block-library/blocks/verse/style-rtl.css 214 B 0 B
build/block-library/blocks/verse/style.css 214 B 0 B
build/block-library/blocks/video/editor-rtl.css 617 B 0 B
build/block-library/blocks/video/editor.css 617 B 0 B
build/block-library/blocks/video/style-rtl.css 303 B 0 B
build/block-library/blocks/video/style.css 304 B 0 B
build/block-library/common-rtl.css 1.01 kB 0 B
build/block-library/common.css 1.01 kB 0 B
build/block-library/editor-rtl.css 8.93 kB 0 B
build/block-library/editor.css 8.93 kB 0 B
build/block-library/style-rtl.css 8.53 kB 0 B
build/block-library/style.css 8.53 kB 0 B
build/block-library/theme-rtl.css 860 B 0 B
build/block-library/theme.css 860 B 0 B
build/block-serialization-default-parser/index.js 1.88 kB 0 B
build/block-serialization-spec-parser/index.js 3.06 kB 0 B
build/blocks/index.js 48 kB 0 B
build/components/style-rtl.css 15.5 kB 0 B
build/components/style.css 15.5 kB 0 B
build/compose/index.js 11.2 kB 0 B
build/core-data/index.js 15.1 kB 0 B
build/data-controls/index.js 830 B 0 B
build/data/index.js 8.97 kB 0 B
build/date/index.js 31.8 kB 0 B
build/deprecated/index.js 768 B 0 B
build/dom-ready/index.js 571 B 0 B
build/dom/index.js 4.95 kB 0 B
build/edit-navigation/index.js 11.1 kB 0 B
build/edit-navigation/style-rtl.css 938 B 0 B
build/edit-navigation/style.css 944 B 0 B
build/edit-post/index.js 306 kB 0 B
build/edit-post/style-rtl.css 6.64 kB 0 B
build/edit-post/style.css 6.63 kB 0 B
build/edit-site/index.js 23.9 kB 0 B
build/edit-site/style-rtl.css 4.04 kB 0 B
build/edit-site/style.css 4.04 kB 0 B
build/edit-widgets/index.js 26 kB 0 B
build/edit-widgets/style-rtl.css 3.22 kB 0 B
build/edit-widgets/style.css 3.22 kB 0 B
build/editor/editor-styles-rtl.css 476 B 0 B
build/editor/editor-styles.css 478 B 0 B
build/editor/index.js 42.8 kB 0 B
build/editor/style-rtl.css 3.89 kB 0 B
build/editor/style.css 3.89 kB 0 B
build/element/index.js 4.62 kB 0 B
build/escape-html/index.js 735 B 0 B
build/format-library/index.js 6.75 kB 0 B
build/format-library/style-rtl.css 620 B 0 B
build/format-library/style.css 621 B 0 B
build/hooks/index.js 2.27 kB 0 B
build/html-entities/index.js 623 B 0 B
build/i18n/index.js 3.57 kB 0 B
build/is-shallow-equal/index.js 698 B 0 B
build/keyboard-shortcuts/index.js 2.54 kB 0 B
build/keycodes/index.js 1.94 kB 0 B
build/list-reusable-blocks/index.js 3.15 kB 0 B
build/list-reusable-blocks/style-rtl.css 629 B 0 B
build/list-reusable-blocks/style.css 628 B 0 B
build/media-utils/index.js 5.31 kB 0 B
build/notices/index.js 1.86 kB 0 B
build/nux/index.js 3.43 kB 0 B
build/nux/style-rtl.css 731 B 0 B
build/nux/style.css 727 B 0 B
build/plugins/index.js 2.54 kB 0 B
build/primitives/index.js 1.43 kB 0 B
build/priority-queue/index.js 790 B 0 B
build/redux-routine/index.js 2.84 kB 0 B
build/reusable-blocks/index.js 2.92 kB 0 B
build/rich-text/index.js 13.4 kB 0 B
build/server-side-render/index.js 2.77 kB 0 B
build/shortcode/index.js 1.7 kB 0 B
build/token-list/index.js 1.27 kB 0 B
build/url/index.js 3.02 kB 0 B
build/viewport/index.js 1.86 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.22 kB 0 B

compressed-size-action

@ockham ockham force-pushed the add/gh-action-create-release branch from 272bef6 to 9f9d17f Compare December 3, 2020 22:51
@ockham ockham force-pushed the add/gh-action-create-release branch 2 times, most recently from 987a7bc to e8db557 Compare January 8, 2021 19:04
@ockham ockham requested a review from a team January 8, 2021 19:09
@ockham ockham marked this pull request as ready for review January 8, 2021 19:10
@youknowriad
Copy link
Contributor

The (locally run) release script works pretty much as before -- only plugin zip creation and GitHub release creation have been removed (since they're now done by the new workflow).

Can we remove the remaining local step by making it a "manual workflow" (workflow_run) we could trigger from the actions page.

I'm happy to change it to publish the release right away

I think it makes sense to publish it.


So if I understand properly this is only for stable releases right, how do we go about doing the same thing for tags like v9.6.0-rc.1 and mark the corresponding Github releases as "pre-release" ?

@ockham
Copy link
Contributor Author

ockham commented Jan 11, 2021

The (locally run) release script works pretty much as before -- only plugin zip creation and GitHub release creation have been removed (since they're now done by the new workflow).

Can we remove the remaining local step by making it a "manual workflow" (workflow_run) we could trigger from the actions page.

I'm not sure we can do that, since the local step is still required for giving the developer a chance to provide a changelog, no?
(I have a scenario in mind where we wouldn't indeed need the local script which I'll elaborate in a follow-up comment.)

I'm happy to change it to publish the release right away

I think it makes sense to publish it.

Okay, I'll change that 👍

So if I understand properly this is only for stable releases right, how do we go about doing the same thing for tags like v9.6.0-rc.1 and mark the corresponding Github releases as "pre-release" ?

The action already does that: https://github.com/WordPress/gutenberg/pull/27488/files#diff-40b47d855e2cffe931290bba37c1b8716642627cbe05ac859728cb95c5da7536R81 😎

@ockham
Copy link
Contributor Author

ockham commented Jan 11, 2021

I have a scenario in mind where we wouldn't indeed need the local script which I'll elaborate in a follow-up comment.

Some context:

The new action tightly couples release creation to tag creation (or rather, pushing a tag to the repo). This seemed to make sense to me, as we have kind of an invariant here: For every tag (that starts with a v), we want to create a release. Furthermore, I assume we'll continue to require creating a tag for each release. Piggybacking on the event of tag creation to me seems more streamlined/automated rather than requiring an extra step from the GUI to trigger release creation.

There are basically two reasons the local script is still required: Tag (and release branch) creation, and providing a prompt for the changelog.

The need for the latter mostly results from the fact that we keep changelog.txt in GitHub. If we want a newly created tag to include the changelog for that version, we have to commit it prior to creating the tag. This is the major obstacle to automating the release process further, especially if we don't just want to use the output from the changelog commander script at face value, but want to give the developer that's in charge of the release the opportunity to edit it.

We can loosen that requirement as follows (but this is something I'd tackle in a subsequent PR, as it requires some more discussion and agreement):

We drop changelog.txt from GH. Instead, we tell the plugin repo upload workflow to use the release notes from the GH release as the changelog for the latest version, and to prepend it to the plugin repo's changelog.txt. In other words, changelog.txt would only live in SVN, but not GH.


This would allow for the following release flow, which personally I'd find the most streamlined:

My preferred end goal for the release flow is as follows:

  1. Developer creates a new tag and pushes it to GH.
  2. The GH action creates a release draft for it, attaching the built plugin zip as an asset, and uses the changelog commander script to prepopulate the release notes.
  3. Developer edits the release notes, and publishes the release.
  4. The plugin repo upload action picks up the release and pushes it to the plugin repo. It uses the release notes as the changelog for the new version, prepending it to the plugin repo's changelog.txt.

At that point, we might not actually need a local release script anymore, as all it would do would be release branch and tag creation, which are arguably easy enough to do manually.

@ockham ockham force-pushed the add/gh-action-create-release branch from f34c0af to 11c25c7 Compare January 11, 2021 13:05
@youknowriad
Copy link
Contributor

I think at this point, I see things a bit differently, here's what would be the ideal end goal for me:

1- Go to Github actions, and choose whether to perform an RC release or a stable release. (could be separate jobs)

IF RC:

  • It's an RC release, use the changelog command to get the changelog. (and during the RC period allows devs to edit it)
  • Publish the github tag, release branch (create if necessary) and create the GitHub release.

IF Stable:

  • Use the latest release branch to create a release,
  • Tag the release and use the changelog from the RC release (the devs had the time to edit the changelog)
  • Publish the Github release
  • Publish the NPM release.

In both situations, the "release manager" only had to interact once. Click the initial job to perform the release.


In your proposal, it's not clear how the release branch gets created. It's also adds extra steps to the process. WDYT

@youknowriad
Copy link
Contributor

1- Go to Github actions, and choose whether to perform an RC release or a stable release. (could be separate jobs)

That said, I'm fine with keeping the release script for now as the replacement of the first part of this (provide changelog, create release branch and tag) and let the action continue from there. It's still just one step to be done but locally.

@ockham
Copy link
Contributor Author

ockham commented Jan 11, 2021

1- Go to Github actions, and choose whether to perform an RC release or a stable release. (could be separate jobs)

That said, I'm fine with keeping the release script for now as the replacement of the first part of this (provide changelog, create release branch and tag) and let the action continue from there. It's still just one step to be done but locally.

Thanks! Yeah, so the goal of the current PR was to trim down time spent on the build process locally, by moving it to the GH action. Otherwise, it doesn't really change the developer experience -- I was thinking of it as a stepping stone for future changes.

@ockham
Copy link
Contributor Author

ockham commented Jan 11, 2021

I think at this point, I see things a bit differently, here's what would be the ideal end goal for me:

Thanks for clarifying 👍

1- Go to Github actions, and choose whether to perform an RC release or a stable release. (could be separate jobs)

Yeah, they probably would need to be separate jobs 🤔

IF RC:

  • It's an RC release, use the changelog command to get the changelog. (and during the RC period allows devs to edit it)

Through regular git commits?

  • Publish the github tag, release branch (create if necessary) and create the GitHub release.

IF Stable:

  • Use the latest release branch to create a release,
  • Tag the release and use the changelog from the RC release (the devs had the time to edit the changelog)
  • Publish the Github release
  • Publish the NPM release.

In both situations, the "release manager" only had to interact once. Click the initial job to perform the release.

In your proposal, it's not clear how the release branch gets created.

I'd probably do that manually.

I agree that my proposal differs a bit on the philosophical front: I'd say that yours is a one-stop shop solution -- which is admittedly very convenient for release managers 😄 Mine encapsulates the GB-specific build and upload parts into actions that are tightly coupled to tag creation -- thus emphasizing the role of the latter -- and exposes the more 'generic' git parts, requiring the release manager to manually create the release branch and tags.

The reason why I prefer the latter is because it gives us more flexibility, and because I believe we cannot (nor should we) shield developers entirely from some (not very advanced) git operations. After all, AFAIU, developers will also need to potentially cherry-pick commits from master to the release branch for the final release. (Arguably, even modifying the changelog during the RC period through regular git commits could be seen as another example.) In other words, we have a choice where to draw the "line" (|) between where we require manual interaction, and what's automated. In the two scenarios we're discussing, it's either:

  1. git cherry-pick | git checkout -b, git tag, build, upload, or,
  2. git cherry-pick, git checkout -b, git tag | build, upload.

I find the latter preferable.

This is just the workflow we're typically dealing with now. The added flexibility of the second scenario pays off even more if we ever wish to modify that workflow. Imagine e.g. someone would want to publish a point release to a previous version 😬 Or any other change to the process, really.

It's also adds extra steps to the process. WDYT

See above for the rationale about git related steps. There's still room to minimize the number of steps further, if we don't want to require the release manager to press 'Publish' on the release -- I think we can include the steps for release note creation that you describe into the current workflow.

That said, I don't think the 'optimal' workflow is solely measured in number of steps: I think it's okay to include an extra step if it

  • makes sense to the person that has to perform it (and fits into their mental model, or even helps them build one), and/or
  • provides an extra sense of security (e.g. being able to have a final look at a release draft prior to making it go live).

Happy to discuss this further so we can find a good solution that we both -- and everyone else -- likes 😄 Sorry that this turned out a bit more verbose again. (I've actually written some internal documentation on this very subject before, I'll try to find it.)

@youknowriad
Copy link
Contributor

Through regular git commits?

Just by editing the release on github

The reason why I prefer the latter is because it gives us more flexibility, and because I believe we cannot (nor should we) shield developers entirely from some (not very advanced) git operations

I think I'm in disagreement with this because I want to be able to say anyone can do a release. And the number of times people ask on which branch they should be to do such thing or such other thing is high for me. I feel it's not really about folks not having the skills but more about removing pressure from folks to have to know exactly what they should be doing and blaming the tools if there's an error instead. Basically what I want is not saying to folks "go head these docs" to perform the release but just "go there and click there" or "just run this, it will tell you what to do". I want to remove the stress factor and the possibility to make errors from the release manager.

But I also agree that we should ask the folks that did previous releases their opinion on this.

@ockham
Copy link
Contributor Author

ockham commented Jan 11, 2021

The release is now published (after attaching the asset), see https://github.com/ockham/gutenberg/runs/1681775057?check_suite_focus=true for a test run (and https://github.com/ockham/gutenberg/releases/tag/v9.7.0 for the resulting release).

I'll change the copy in the release script now.

@ockham
Copy link
Contributor Author

ockham commented Jan 11, 2021

I'll change the copy in the release script now.

6bb426b

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

Nice

@ockham ockham merged commit 8a26233 into master Jan 11, 2021
@ockham ockham deleted the add/gh-action-create-release branch January 11, 2021 16:50
@github-actions github-actions bot added this to the Gutenberg 9.8 milestone Jan 11, 2021
youknowriad pushed a commit that referenced this pull request Jan 12, 2021
Build Gutenberg upon creating a tag that starts with `v`, and creating a draft release with the build attached to it. Furthermore, extract the changelog for the current release from `changelog.txt`, and use it to populate the release notes.

The (locally run) release script works pretty much as before -- only plugin zip creation and GitHub release creation have been removed (since they're now done by the new workflow).

The main benefit of this is that the plugin build is decoupled from people's local systems and setups, yielding reproducible builds, and cutting down time spent running the release process locally (freeing up people's systems earlier). (One micro-optimization is e.g. that it's no longer necessary to enter a GH access token during the release process.)
@tellthemachines
Copy link
Contributor

But I also agree that we should ask the folks that did previous releases their opinion on this.

Late to the party, but I like the idea that anyone should be able to do a release. That said, I find the hardest part of the process (assuming tooling works correctly) to be editing the changelog and writing the release post, and I suspect these tasks will be nearly impossible to anyone who isn't reasonably familiar with the repo and with ongoing work, priorities, etc.

For feedback going forward, perhaps a post on make/core would help?

Also, let's not forget to update the release docs with the latest changes!

@ockham
Copy link
Contributor Author

ockham commented Feb 24, 2021

But I also agree that we should ask the folks that did previous releases their opinion on this.

Late to the party

Late to reply myself now -- apologies, I let this fall through the cracks.

but I like the idea that anyone should be able to do a release. That said, I find the hardest part of the process (assuming tooling works correctly) to be editing the changelog and writing the release post, and I suspect these tasks will be nearly impossible to anyone who isn't reasonably familiar with the repo and with ongoing work, priorities, etc.

Agree, the 'editorial' part of a release is hardest.

For feedback going forward, perhaps a post on make/core would help?

I'm planning one. Overall, once I've finished my little tool automation project (mostly #28138 at this point), I'd like to publish a post about the (hopefully) simplified release process; and to describe the role of a release manager, which would include that 'editorial' part, plus being responsible for bug fixes and patch releases over the lifecycle of a version. (This has been partly discussed with @mcsf et al).

Also, let's not forget to update the release docs with the latest changes!

I've been a bit slow with this one since I hoped to do it all in one fell swoop once I'm done with #28138, but since that has been dragging out a bit, here goes a doc update that reflects the current state: #29091.

ockham added a commit that referenced this pull request Mar 18, 2021
Allow manual triggering of the workflow to create a new release, per [this discussion](#27488 (comment)).

The end goal is for the release manager to run the entire release process from GitHub, and to minimize manual interaction.
- ✋ Release manager starts release process manually.
- 🤖 GitHub workflow bumps version numbers in plugin files, builds Gutenberg plugin, creates release draft, and prefills it with release notes based on changelog script output.
- ✋ Release manager edits release draft, and eventually publishes it. This creates the tag.
- 🤖 (Other) GitHub workflow prepends release notes to `changelog.txt`, uploads Gutenberg plugin and updated `changelog.txt` to WP.org plugin repo.

Functionally, this is as close as possible to the previous workflow. The major difference is that `changelog.txt` is only updated _after_ tagging. This is a result of using the GitHub release draft UI to edit and revise release notes. It's not possible to include the result of those changes _before_ tagging.

Release docs are updated to reflect these changes. The previously used local release script is removed.
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.

3 participants