Please familiarize yourself with the SETUP.md file before releasing.
Follow these steps for new pull requests:
-
Please note the publishing method (see below).
-
Ensure when you create your pull request that:
a. It merges to
trunk
. The release flow for VIP-CLI follows this pattern: feature branch ->trunk
branchb. The feature branch follows A8C branch naming conventions, e.g.:
add/health-query
,fix/subsite-mutation
, etc.c. The pull request code and description contain no sensitive information. Please do not include any internal links in PRs, changelogs, testing instructions, etc. as this is a public repository.
d. You have included changelog entry by adding a
## Changelog Description
section to the GitHub pull request description. All changelogs are posted to the VIP Cloud Changelog P2 which customers can view and follow. -
Once you've created your pull request, ensure that:
a. You have added all the automated tests required.
b. You have completed manual testing of your change.
-
If updating a dependency (NPM package or Node), follow the guidelines on updating dependencies.
-
Have your pull request reviewed by a colleague and approved — especially if it is a large change or a complex addition.
-
Verify that your pull request passes all automated tests.
-
Merge your pull request.
A few steps should be completed before releasing:
-
Verify that all relevant pull requests are merged.
-
Please note the publishing method (see below).
-
Determine strategy to respond to problems post-deployment.
-
The release has been tested across macOS, Windows, and Linux.
-
All tests pass and your working directory is clean (we have pre-publish checks to catch this, just-in-case).
-
You have completed final testing before deployment.
-
The pre-publish script has been run. This script performs some confidence checks to avoid common mistakes.
-
Finally, release your changes as a new minor or major NPM version.
If you need to publish a security release, see details below.
Run the following to generate a changelog entry for CHANGELOG.md:
export LAST_RELEASE_DATE=2021-08-25T13:40:00+02
gh pr list --search "is:merged sort:updated-desc closed:>$LAST_RELEASE_DATE" | sed -e 's/\s\+\S\+\tMERGED.*$//' -e 's/^/- #/'
You can release either using GitHub Actions or locally.
This is the preferred method for pushing out the latest release. The workflow runs a bunch of validations, generates a build, bump versions + tags, pushes out to npm, and bumps to the next dev version.
Please keep in mind internal guidelines before releasing.
To release, follow these steps:
- Initiate the release process here.
- On the right-hand side, select "Run Workflow".
- Pick your preferred version bump.
- Click
Run Workflow
. - Wait for a pull request to appear. The pull request will update the version number and shall be assigned to you.
- When ready, merge the pull request. This will lead to a new version to be published on npmjs.com.
- Another pull request will be created to bump to a development version, also assigned to you. Merge it to finish the process.
patch
: for non-breaking changes/bugfixes and small updates.minor
: for some new features, bug fixes, and other non-breaking changes.major
: for breaking changes.
Publishing via the GitHub Action requires that the NPM_TOKEN
be set correctly in GitHub Actions secrets. This should be an npm token generated for a bot user on the npm @automattic org that has publish access to this repo.
To publish locally, follow these steps:
- Create a pull request that adds the next version's changelog into
trunk
. Use the Changelog Generate Hint above to generate the changelog, and refer to previous releases to ensure that your format matches. - Merge it after approval.
- Make sure
trunk
branch is up-to-date:git pull
. - Make sure to clean all of your repositories of extra files. Run a dangerous, destructive
command
git clean -xfd
to do so. - Run
npm install
. - Set the version (via
npm version minor
ornpm version major
ornpm version patch
) - For most regular releases, this will be
npm version minor
. - Push the tag to GitHub (
git push --tags
) - Push the trunk branch
git push
- Make sure you're part of the Automattic organization in npm
- Publish the release to npm (
npm publish --access public
) the script will do some extra checks ( node version, branch, etc) to ensure everything is correct. If all looks good, the new version will be published and you can proceed. - Edit the release on GitHub to include a description of the changes and publish (this can just copy the details from the changelog).
Once released, it's worth running npm i -g @automattic/vip
to install / upgrade the released version to make sure everything looks good.
Sometimes, we want to release a version we can test before releasing it to the public. In order to that, we need to release it under a tag other than latest
, usually next
. By default, npm
install from the latest
tag, so if @next
isn't specified explicitely in the installation command like npm install @automattic/vip@next
, a user will not get this version.
In order to do that, please follow this:
- Manually change the version in
package.json
andpackage-lock.json
to a dev version. Example:1.4.0-dev1
- Run
npm publish --tag next
(When--tag
is specified, we bypass the usual branch protection that doesn't allow you to publish form a brunch other thantrunk
).
You can repeat this with every new version until you're happy with your version and ready to a public release. We currently don't support multiple branches for multiple versions. When it's the case, this process needs to be done for every version in every branch.
There may be times when we need to push out a critical fix to the most recent release (or several past releases) such as for patching security issues or major bugs. This can be complicated by the fact that we may have some larger changes already merged into the trunk
branch.
For these cases:
git checkout
to the tag of the previous release.- Apply the fix (either manually or by cherry-picking).
- Follow the release steps outlined above (as a
patch
release).
Then, repeat for any additional versions that we need to patch.
TODO: How to revert to a good state in case of problems?