This document (and the [related PR template](../../.github/release_pull_request_template.md)) outlines the process of releasing new versions of the blocks plugin.
- Configure a GitHub token for release scripts to use.
- https://github.com/settings/tokens
- Select the following permissions:
-`admin:org`
-`public_repo`
-`read:user`
- Ensure your token is available to scripts, e.g. `export GH_API_TOKEN={YOUR-TOKEN}` or similar.
- Get WPORG plugin svn commit access - ask a team member.
_Outcome_: **You are equipped to ship a release!**
## Release process
### Lead-up to release
#### Ensure release development is complete
- Github milestones are used for all releases. We do releases every two weeks from the latest release milestone - [example](https://github.com/woocommerce/woocommerce-gutenberg-products-block/milestone/43)
- If a patch release is needed, then the milestone for the patch release is created and a decision will be made whether it just includes `cherry-picked` changes, or all the changes currently slated from the current release milestone. If the latter, then all the issues and pulls in the current release milestone are moved to the patch release, and the the release is built from the patch release branch rebased on `main`. In **most cases**, patch releases will involve cherry-picking.
- Ensure all issues/PRs intended for this release are merged, closed and linked to release.
- All PRs should have changelog entry, or `skip-changelog` tag.
- Check with the team to confirm any outstanding or in progress work.
- Review recent [dependency updates](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pulls?q=is%3Apr+is%3Aclosed+author%3Aapp%2Frenovate) to be included in this release, and ensure they have been adequately tested.
Using the [release pull request template](../../.github/release_pull_request_template.md), create a pull request for the release branch. This contains a checklist to go over, and serves as a place to contain all planning/communication around the release. The release process can span a few days, so this PR is an essential way for the team to keep track.
You'll work through the checklist over the rest of the process below. The PR will remain open and unmerged until the release is live - you'll merge it much later (see `After release` below).
- Push readme changes to release branch on origin repo.
- Note: you can push your readme changes directly to branch – no need for a PR & review process.
- Create testing notes for the release (you might be able to copy some from the pulls included in the release). Add the notes to [`docs/testing/releases`](../testing/releases/) (and update the [README.md index](../testing/releases/README.md) there)
_Outcome_: **Release branch has `readme.txt` is updated with release details.**
#### Build zip & smoke test
- Ensure you are on the tip of the release branch, e.g. `git pull origin release/2.5`
Now's your last chance to tick off everything in the PR checklist! These are all important to consider. If something is not applicable, add info to the description. Otherwise provide info and relevant details for each item. Any questions - ping your team in slack :)
Note - the PR is not merged here either - read on :)
-**ALERT**: This script will ask you if this release will be deployed to WordPress.org. If you answer yes, then a GitHub release is created and this will trigger a GitHub workflow we have setup to deploy the contents of the release tag to GitHub. If you answer no, then a tag only is created and nothing will be deployed to GitHub. Note: Pre-releases GitHub releases ARE deployed to WordPress.org but the deploy script will not update the stable version in readme.txt (so pre-releases are only available in the svn tags).
- Merge the release branch back into `main` (without the branch being up to date with `main`). This may have merge conflicts needing resolved if there are cherry-picked commits in the release branch.
- For _major_&_minor_ releases, update version on `main` with dev suffix, e.g. [`2.6-dev`](https://github.com/woocommerce/woocommerce-gutenberg-products-block/commit/e27f053e7be0bf7c1d376f5bdb9d9999190ce158).
- Edit the (GitHub) milestone and add the current date as the due date (this basically is used for easy reference of when the milestone was completed).
All releases (except RCs, betas etc) should be included in WooCommerce core. We do this by adding a PR on WooCommerce Core repo immediately after our release is completed.
- Create the pull request in the [WooCommerce Core Repository](https://github.com/woocommerce/woocommerce/) that [bumps the package version](https://github.com/woocommerce/woocommerce/blob/master/composer.json) for the blocks package to the version being pulled in.
- Copy the release pull request notes for that tag (and merge any notes from previous tags if you're bumping up from non consecutive versions) into the pull request description.
- Run through the testing checklist to ensure everything works in that branch for that package bump. **Note:** Testing should include ensuring any features/new blocks that are supposed to be behind feature gating for the core merge of this package update are working as expected.
- Verify and make any additional edits to the pull request description for things like: Changelog to be included with WooCommerce core, additional communication that might be needed elsewhere, additional marketing communication notes that may be needed etc.
- After the checklist is complete and the testing is done, it will be up to the WooCommerce core team to approve and merge the pull request.
_Outcome:_ __The package is updated in WooCommerce core frequently and successfully merged to WooCommerce main branch as a stable release.__
#### Post release announcement on [WooCommerce Developer Blog](https://woocommerce.wordpress.com/category/blocks/)
Use previous posts for inspiration. If the release contains new features, or API changes, explain what's new so Woo devs/builders/merchants can get excited about it. This post can take time to get right - get feedback from the team, and don't rush it :)
- Ensure the release notes are included in the post verbatim.
- Don't forget to use category `Blocks` for the post.
_Outcome:_ __There's a public release announcement, with clear info about what's new, roughly within a day of actual release.__
- 2 == _major_ version; has breaking changes or major new features
- 5 == _minor_ version; has new features
- 11 == _patch_, aka point / revision / fix; has bug fixes and improvements to existing features
- 2.0 is a _major_ release
- 2.5 is a _minor_ release
- 2.5.11 is a _patch_ release
There are some differences to our release process for each kind of release - these are detailed in the steps above.
## Appendix: updating a specific file on WPORG
Sometimes, we need to update a single file in WordPress.org without wanting to do a full release, for example, updating the `readme.txt` versions or descriptions. In order to do that, refer to the _[Editing Existing Files](https://developer.wordpress.org/plugins/wordpress-org/how-to-use-subversion/#editing-existing-files)_ section of the Subversion guide in developer.wordpress.org or follow these steps:
1. Checkout the plugin repo:
```
$ svn co "http://plugins.svn.wordpress.org/woo-gutenberg-products-block/"
$ cd woo-gutenberg-products-block
```
2. Modify the files you want to change in `trunk` or `tags/x.y.z`.