Scripts
Release
Prerequisites
- Make sure you have added the
material-ui-docsandupstreamremotes to deploy the documentation:git remote add upstream https://github.com/mui/material-ui.git git remote add material-ui-docs https://github.com/mui/material-ui-docs.git - Generate a GitHub Token at https://github.com/settings/personal-access-tokens/new and add it to your shell rc script (either
.bashrcor.zshrc) asGITHUB_TOKEN.
Releasing a minor version
A minor release goes like this:
Prepare
The following steps must be proposed as a pull request.
-
Generate the changelog with
pnpm release:changelogThe output must be prepended to the top levelCHANGELOG.mdpnpm release:changelog --helpfor more information. If your GitHub token is not in your env, pass it as--githubToken <my-token>to the above command. -
Clean the generated changelog:
- Match the format of https://github.com/mui/material-ui/releases.
- Change the packages names casing to be lowercase if applicable
-
Update the root
/package.json's version -
Run
pnpm release:version. Keep in mind:- Only packages that have changes since the last release should have their version bumped.
- If they have changes, packages that follow Material-UI's versioning scheme should be bumped to the same version as the root
package.json. This might require skipping some version numbers.
-
Open PR with changes and wait for review and green CI.
-
Merge PR once CI is green and it has been approved.
Release
-
Go to the publish action.
-
Choose "Run workflow" dropdown
- Branch: master
- Commit SHA to release from: the commit that contains the merged release on master. This commit is linked to the GitHub release.
- Run in dry-run mode: Used for debugging.
- Create GitHub release: Keep selected if you want a GitHub release to be automatically created from the changelog.
- npm dist tag to publish to Use to publish legacy or canary versions.
-
Click "Run workflow"
-
Refresh the page to see the newly created workflow, and click it.
-
The next screen will say "@username requested your review to deploy to npm-publish", click "Review deployments" and authorize your workflow run. Never approve workflow runs you didn't initiaite.
Documentation
pnpm docs:deploy to deploy the documentation (it lives at https://material-ui.netlify.app/) with the latest changes.
Force push if necessary.
Publish GitHub release
After the documentation deployment is done, review the draft release that was created, then publish it. At this point the release tag gets created. GitHub releases page
Announce
After the docs is live, follow the instructions in https://mui-org.notion.site/Releases-7490ef9581b4447ebdbf86b13164272d.
Releasing a hotfix version
A hotfix release could happen if there is a regression fix that could not wait for the monthly release cycle and the master branch already contains not yet to be released commits. If you can publish an earlier minor or patch, just prefer that over a hotfix release.
It goes like this:
Prepare
Hotfix branch creation requires the help of a repository admin. They need to take the following steps:
-
Check out the commit for the latest release tag.
-
Create a branch named
release/<PATCH_VERSION>where<PATCH_VERSION>is the next semver patch version from that release tag. -
force push the branch to
upstream:git push -f upstream release/<PATCH_VERSION>
The following steps must be proposed as a pull request to release/<PATCH_VERSION>.
- check out
release/<PATCH_VERSION>and cherry-pick the hotfix commits on top of it. - Generate the changelog with
pnpm release:changelogThe output must be prepended to the top levelCHANGELOG.mdpnpm release:changelog --helpfor more information. If your GitHub token is not in your env, pass it as--githubToken <my-token>to the above command. - Clean the generated changelog:
- Match the format of https://github.com/mui/material-ui/releases.
- Change the packages names casing to be lowercase if applicable
- Update the root
/package.json's version - Run
pnpm release:version. Keep in mind:- Only packages that have changes since the last release should have their version bumped.
- If they have changes, packages that follow Material-UI's versioning scheme should be bumped to the same version as the root
package.json. This might require skipping some version numbers.
- Open PR with changes and wait for review and green CI.
- Merge PR into
release/<PATCH_VERSION>once CI is green and it has been approved. - Open and merge a PR from
release/<PATCH_VERSION>to master to correct the package versioning and update the changelog.
Release the packages
-
Run
pnpm release:publish. You may be asked to authenticate with GitHub when running the command for the first time or after a very long time. -
It'll automatically fetch the latest merged release PR and ask for confirmation before publishing.
-
If you already know the sha of the commit, you can pass it directly like
pnpm release:publish --sha <your-sha>. -
Other flags for the command:
- --dry-run Used for debugging. Or directly run
pnpm release:publish:dry-run. - --dist-tag Use to publish legacy or canary versions.
- --dry-run Used for debugging. Or directly run
-
This command invokes the Publish GitHub action. It'll log the url which can be opened to see the latest workflow run.
-
The next screen shows "@username requested your review to deploy to npm-publish", click "Review deployments" and authorize your workflow run. Never approve workflow runs you didn't initiaite.
Documentation
Run git push -f material-ui-docs HEAD:latest to deploy the documentation (it lives at https://material-ui.netlify.app/) with the latest changes.
Force push if necessary.
Publish GitHub release
After the documentation deployment is done, review and then publish the release that was created in draft mode during the release step GitHub releases page
Cleanup
After the release is done, merge the branch back to master. While merging make sure to resolve conflicts considering master may have future changes done in the same files.
Announce
After the docs is live, follow the instructions in https://mui-org.notion.site/Releases-7490ef9581b4447ebdbf86b13164272d.
Deploy documentation without a release
Sometimes it is necessary to deploy the selected commit(s) without deploying all the changes that have been merged into the main branch since the previous release (for example publishing a blog post or releasing urgent docs updates).
Note: The instructions below are for deploying to the latest branch of the material-ui-docs repository, which points to https://mui.com/. If you need to deploy to a different subdomain, replace latest with the appropriate branch name:
latest:https://mui.com/next:https://next.mui.com/v*.x:https://v*.mui.com/
To do so, follow these steps:
-
Add the
material-ui-docsremote if you haven't done this already:git remote add material-ui-docs https://github.com/mui/material-ui-docs.git -
Fetch the latest changes from the
material-ui-docsremote:git fetch material-ui-docs latest -
Switch to the
latestbranch frommaterial-ui-docsremote:git switch --detach material-ui-docs/latest -
Cherry-pick the commit(s) that you want to include in the new deployment:
git cherry-pick <commit>It will commit the changes if there are no conflicts.
In case of conflicts you will need to resolve them and commit the changes manually.
If this command fails with the message 'bad revision', it means that the commit doesn't exist on your local repository. The commit might have been created on a remote branch, probably when merging into
masterorv*.x. In this case, you'll have to fetch the latest changes of the corresponding remote branch and then try again. -
Push the changes to the
material-ui-docsremote:git push material-ui-docs HEAD:latest -
Switch from detached
HEADback to your last checked out branch:git checkout -