This is a checklist for repository maintainers. It covers all the steps involved in releasing a new version, including publishing to NPM and updating the gh-pages branch. We have tried to automate as many of these steps as possible using GitHub Actions. The workflows involved are in the (hidden) .github directory.
A "regular" release includes new changes that were introduced to the master branch since the previous release. A hotfix release instead skips any such changes and only addresses urgent problems with the previous release.
- Ensure your local
masterbranch descends from the previous release branch and that it is in a state that you want to release. Exception: for hotfixes, ensure you have an up-to-date local copy of the previous release branch instead. - Decide on the next version number, respecting semver. For the sake of example we'll use
1.2.3as a placeholder version throughout this checklist. - Create a
release/1.2.3branch based onmaster. Exception: if this is a hotfix, start from the previous release branch instead and call ithotfix/1.2.3. - Bump the version number in the
package.jsonand theyarn.lockby running the commandyarn version --no-git-tag-version, with the extra flag--major,--minoror--patchdepending on which part of the version number you're incrementing (e.g.,--patchif you're bumping from 1.2.2 to 1.2.3). Note that you can configureyarnto always include the--no-git-tag-versionflag so you don't have to type it every time. - Bump the version number in the source code and in
docs/index.mdaccordingly. - Commit the changes from steps 4 and 5 with a commit message of the format
Bump the version to 1.2.3. - Add more commits to extend the change log and to update any other documentation that might require it. Ensure that all documentation looks good.
- Push the release branch and create a pull request against
master(also if it is a hotfix). - At your option, have the release branch reviewed and add more commits to satisfy any change requests.
- The "Continuous Integration" workflow will trigger automatically on the pull request. This runs the test suite against multiple environments. Wait for all checks to complete.
- If any checks fail, add more commits to fix and repeat from step 10.
- When all reviewers are satisfied and all checks pass, apply the "ready to launch" label to the pull request. This will trigger the "Prepublication staging" workflow, which will merge the release branch into the
prepublishbranch. Merge manually if the workflow fails for whatever reason. Note: do not merge intomasteryet. - The merging of new changes into
prepublishwill trigger the "Continuous Deployment" workflow, which is documented below. Pay attention as the deployment workflow progresses. - If the deployment workflow fails, identify the failing step and address as quickly as possible. Possible solution steps include:
- Adding new commits to the release branch and repeating from step 12 (most likely if the docs fail to build for some reason).
- Manually pushing new commits to the
prepublishbranch and repeating from step 13 (this might be needed in case of merge conflicts, although this is highly unlikely). - Manually running
yarn publish(if something is wrong with the NPM registry or the authentication credentials). - Manually merging
prepublishintogh-pages(in unlikely case of merge conflicts). - Manually tagging the release on
gh-pages.
- When the deployment workflow has completed, double-check that the new version was published to NPM, that the website was updated and that the repository contains a tag for the new release.
- Finally merge the release branch into
master, but keep the branch around for a few days in case you need to do a hotfix. - Delete the release branch. You can still restore it if necessary, by tracing the history graph two commits back from the release tag.
This workflow is defined in .github/workflows/cd.yml. Note that roughly the first half of the steps in that file consists of basic boilerplate to check out the source and install dependencies.
The publishing to NPM depends on a secret named NPM_TOKEN, representing the API token of the NPM account that owns the underscore-contrib package. Only admins of the documentcloud organization can access this setting.
- Checkout the source, restore caches and install the dependencies.
- Run
yarn grunt dist docco tocdoc. - Commit the output of the previous step to the
prepublishbranch. - Publish to NPM.
- Merge the
prepublishbranch intogh-pages. - Tag the tip of
gh-pageswith the version number in thepackage.json.