EDS uses SemVer semantic versioning to keep track of ongoing changes to the product. The three types of versions are:
- Major (X.y.z) - Major versions contain breaking changes to Education developers' builds.
- Minor (x.Y.z) - Minor versions add new features or deprecate existing features without breaking changes.
- Patch (x.y.Z) - Patch versions fix defects or optimize existing features without breaking changes.
Look to this helpful document from the Morning Star design system for detailed guidance on versioning.
We currently use standard-version to increment the version number in package.json
, create a git tag for the new release, and update CHANGELOG.md
based on the commit log.
If you need to create a major release (e.g., one with breaking changes), it is very helpful to folks to include steps on how they can incorporate fixes for those changes. With that in mind, include any instructions for each breaking change in the release notes (step nr. 10).
For an example of what this can look like, see the release notes for EDS v13.
- Create a
details
block for each change, using the change text in thesummary
- Supply steps an engineer would take to port old code to the new format
- If the change is very complex, link to a codemod that can be run to automate the migration
Before the first time you publish, make sure to:
- set up Two Factor Authentication for your npm account
- run
npm login
in your terminal to generate an access token for publishing - are referring to the docs on
next
as there may have been updates to the release steps
We follow a git-flow based model, where:
- Development happens on
next
- Release branches are cut from
next
. Only bugfixes and documentation updates can be added to release branches. - Hotfix branches are cut from
main
. Only urgent bugfixes and documentation updates can be added to hotfix branches. - Release and Hotfix branches are merged back into
main
andnext
after the publish is completed
- Before beginning, run
git fetch origin
to ensure you have the latest remote changes. - Confirm that all checks are green on CI.
- Run
git checkout next && git pull origin next && yarn install
to update your local copy ofnext
. - Determine the next version that will be released. An easy way to do this is with
yarn release --dry-run
- Run
git checkout -b release-v<version>
- Run
yarn release
if the recommended version is correct. If it isn't, useyarn release:
followed by the proper version type (patch, minor, major)
If working on a hotfix for the latest version
- Before beginning, run
git fetch origin
to ensure you have the latest remote changes. - Run
git checkout main && git pull origin main && yarn install
to update your local copy ofmain
. - Run
git checkout -b hotfix-v<currentVersion>
- Create a new commit with the fix on this branch
- Determine the next version that will be released. An easy way to do this is with
yarn release --dry-run
- Run
yarn release
if the recommended version is correct. If it isn't, useyarn release:patch
(hotfix commits should not be minor or major)
NOTE: The package is not published, yet. If needed, you can make additional changes to CHANGELOG.md now.
- Push the branch up, including tags:
git push --follow-tags origin <branch> # this will also push tags
- Open a pull request for the branch, merging into
main
.
For the commit message, use the new version's content in the CHANGELOG.md (e.g., all the changes for version 1.2.3). Review the content in the changelog to make sure the notes, and the from-version and to-version are correct. Note the link to the storybook on this PR CI/CD. You will add this link to the GitHub release notes later.
NOTE: if this is a hotfix release for an older version of EDS (not latest), skip to step 9.
Merge the PR through a merge commit:
Once merged, wait until the builds complete on main
before continuing.
- Pull down the most up-to-date version of main:
git checkout main && git pull && yarn install && yarn build
- Publish the package:
npm publish
- Create a new release based on the newly-created tag.
To prepare the message:
- Include the package name before the version number in the release name field (e.g., "@chanzuckerberg/[email protected]")
- Use the same text used for the pull request description above (from CHANGELOG.md).
- Include any additional notes from the System Designers.
- Include the link for the built storybook in the description.
The latter will automatically post to relevant slack channels. When doing a major version release, don't forget to include notes on each breaking change.
- Lastly, run the following to "back merge" release changes to
next
:
git checkout main && git pull origin main && git checkout next && git pull && git merge main && git push
For testing a release to build confidence.
- Run
yarn release:alpha
to usestandard-version
to create appropriate tags and updates. - Run the last command output by
standard-version
as above. It will look something like:
git push --follow-tags origin <branch> && npm publish --tag alpha
- Now, publish to the GitHub Registry
npm publish --tag alpha --registry=https://npm.pkg.github.com/
NOTE: running npm publish
with --registry
may edit your .npmrc file and force all subsequent publishes to go to the GH Registry. Remove the scope/registry map from ~/.npmrc
after publishing.
- Run
git log
and note the version tag on the latest (release) commit - Make any edits you want to
CHANGELOG.md
- Run
git add . && git commit --amend
to update the release commit - Remove the tag from the old commit:
git tag -d v<version>
- Re-tag the release commit:
git tag v<version>