-
Notifications
You must be signed in to change notification settings - Fork 3
Deployment And Publishing
- Setting up Git Flow
- Step-by-Step instructions for a regular release
- Instructions to hotfix/patch an earlier release
git flow init- Which branch should be used for bringing forth production releases?
master - Which branch should be used for integration of the "next release"?
dev - How to name your supporting branch prefixes?
- Feature branches?: return¬
- Release branches?: return¬
- Hotfix branches?: return¬
- Support branches?: return¬
- Version tag prefix? [] return¬
-
Ensure you have latest on both
devandmasterbranches. -
Checkout the dev branch.
git checkout dev -
Start a release by running.
git flow release start [sematic-version-name-here] -
Do all of the updates necessary for documenting the new version:
- Update the version number in
./package.json. - Do
npm installto ensure./package-lock.jsonis updated as well. The version number change should theoretically be the ONLY change in this file. - Update
./src/versions.js. - Add new entry in
./CHANGELOG.md. - If there have also been changes to the Documentation website (as well as library components):
- Update the version number in
./docs/package.json. - Do
npm installin the/docsdirectory to update./docs/package-lock.json. The version number should be the only change. - Add new entry in
./docs/CHANGELOG.md.
- Update the version number in
- Update the version number in
-
Commit these changes (to the release candidate branch).
- Usually I put a commit message like:
feat: update version to [sematic-version-name-here]orfeat: update version to [sematic-version-name-here] (and docs version to [docs-semantic-version])
- Usually I put a commit message like:
-
OPTIONAL: Push the release branch to the remote.
git push --set-upstream origin release/[branch-name-here]OR
git flow release publish [sematic-version-name-here]- Usually this step is not needed; that's why it's indicated as optional.
-
Finish the release by running.
git flow release finish [sematic-version-name-here]- When prompted to enter a commit message for the tag, I usually enter a message like:
Tag version 10.7.4. - Note this is usually done in VI editor, so you'll need to hit
Ito enter insert mode, type the message, hitEnterto go to the next line, hitEscto exit insert mode, type colon (:) and thenwqto save and exit (write/quit).
- When prompted to enter a commit message for the tag, I usually enter a message like:
-
Push the dev branch.
git push -
Push the tag.
git push origin [sematic-version-name-here]// pushes just single tag -
Run the publish script.
npm publish- This will compiles
/srcinto/lib, publish the new version to the NPM registry, check outmaster, pushesmaster, and then checks outdevbranch again. - If you have MFA (multi-factor authorization) setup with NPM, you might need to provide an OTP (one-time-pad) code from your authenticator application in order to do the publish.
- This will compiles
-
Update GitHub Releases - add release notes for the new version. The ones automatically generated by the "generate release notes" button that lists merged PRs are just fine for this.
-
Profit!
Sometimes it is necessary to release a newer patch of an older version of React CM UI. This often is required when fixing bugs in a release or hotfix branch of the HC back-office client application, whenever a newer React CM UI version has been published than the one referenced by the HC in said release or hotfix branch..
Example: the hotfix or release candidate is using React CM UI 6.1.0 but there is now also a React CM UI 6.2.0 (or 7.0.0, etc.). But we need to fix a blocking issue in 6.1.x, i.e. we require a 6.1.1.
This is a somewhat odd procedure, and the existing git flow automation won't do the right thing, so here are the manual steps.
-
Create a new hotfix branch from the tag of the version we wish to base things on. Using our example of hot-fixing a
6.1.1from6.1.0when latest is say6.2.0, do this:git checkout -b hotfix/6.1.1 6.1.0 -
Do all of the code fixes, and also bump the version in
package.jsonand updateCHANGELOG.mdin this branch. Important note for the Changelog: we want to keep it chronological. So, eventually when we merge back todev, we will want the entry for version6.1.1on the top (above a higher version that was released earlier, e.g.6.2.0). -
Do
npm publish --tag [some tag name]to publish this version of React CM UI.[some tag name]should be some "kebab-case" identifier that is terse but describes the reason for the patch, e.g.date-picker-hotfix. It is important to include an npm tag so that this publish does not move thelatesttag. Movinglatestis the default behavior, but we don't want that in this case; we wantlatestto continue pointing to the highest numbered version, latest and greatest, e.g.6.2.0or whatever. Note that the npm post-publish command runs some git commands (pushingdevandmasterbranches) and this may fail (because we might not have merged things or be completely up-to-date indevandmaster); that's okay. As long as thenpm publishstep itself succeeds, all is good. -
Switch back to the hotfix branch and manually create and push a Git tag from the latest commit in the hotfix branch. This is very important, in case we have the pleasure of doing this again, e.g. we need
6.1.2!git tag -a 6.1.1 -m "Tag version 6.1.1"
git push origin 6.1.1 -
Now merge changes from the hotfix branch into
dev. This can be done with a local merge, or a PR, or however you like. Be on lookout for conflicts! Some, likepackage.jsonversion andCHANGELOG.mdare expected and obvious, but of course the actual code could conflict too! -
At this point, we can delete the hotfix branch. And we should do another regular release from
devbranch (i.e. let's also produce a6.2.1that has all the goodness from6.2.0plus our new bug fix).