|
| 1 | +# Releasing MongoDB Node.js Packages |
| 2 | + |
| 3 | +> [!NOTE] |
| 4 | +> _Last updated: Thu Jun 6_ |
| 5 | +
|
| 6 | +## Pre-requisites |
| 7 | + |
| 8 | +- You must be an employee of MongoDB. |
| 9 | +- You must have maintainer access to the repository you are publishing a release for. |
| 10 | + |
| 11 | +## `release-please` |
| 12 | + |
| 13 | +Every commit that lands on a release branch **MUST** follow [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) formatting. |
| 14 | +The format of each commit message determines the next semantic version from that branch. |
| 15 | +We use a CLI tool called [`release-please`](https://github.com/googleapis/release-please) via a [github action](https://github.com/googleapis/release-please-action) of the same name. |
| 16 | +`release-please` maintains our `HISTORY.md` and automatically writes the new version to our `package.json` (etc.) files. |
| 17 | +Every new commit to a release branch caused the action to update the history and version files in a pending release PR. |
| 18 | +Merging the release PR will make the action create a Github Release and subsequently because a "release_created" flag is true, we run npm publish from within the same action. |
| 19 | + |
| 20 | +> [!TIP] |
| 21 | +> See the release workflow here: [.github/workflows/release.yml](.github/workflows/release.yml) |
| 22 | +
|
| 23 | +## Release Notes |
| 24 | + |
| 25 | +The contents of the release PR's body becomes the contents of the Github Release. |
| 26 | +This is used to prepare descriptive and colorful release notes using [Github Flavored Markdown](https://github.github.com/gfm/). |
| 27 | +All of the PRs that are going into the next release should have **Release Highlight** sections describing the downstream impact of the fix or feat. |
| 28 | +These sections **MUST** contain a level 3 markdown header. |
| 29 | + |
| 30 | +``` |
| 31 | +<!-- RELEASE_HIGHLIGHT_START --> |
| 32 | +
|
| 33 | +### Enhanced compatibility with CoffeeScript |
| 34 | +
|
| 35 | +The MongoDB driver can now generate a cup of joe. |
| 36 | +
|
| 37 | +<!-- RELEASE_HIGHLIGHT_END -->` |
| 38 | +``` |
| 39 | + |
| 40 | +> [!TIP] |
| 41 | +> See the release notes workflow here: [.github/workflows/release_notes.yml](.github/workflows/release_notes.yml) |
| 42 | +> The supporting scripts for parsing and building markdown are here: [.github/scripts](.github/scripts) |
| 43 | +
|
| 44 | +## Release Instructions |
| 45 | + |
| 46 | +1. On slack notify `#node-driver-docs`, `#nodejs-devtools`, and `#mongoose` that we intend to publish a release. |
| 47 | + - You may skip this step if you are releasing a package other than the driver. |
| 48 | +1. Comment "`run release_notes`" on the release PR. |
| 49 | + - This will kick off the action that reads the notes from each PR going into the release. |
| 50 | + - Double check the result looks logically organized |
| 51 | + - You may edit the PR body for any quick edits or re-orderings. |
| 52 | + - If there are a number of changes, edit the original PRs and post a new `run` comment |
| 53 | +1. Merge the release PR |
| 54 | + - If this is a release to a previous major, navigate to the new release and reset "latest" to our latest release in our _current_ major. |
| 55 | +1. If this is a new driver minor release, generate the new documentation |
| 56 | + - **Check out the git tag** and run `npm run build:docs -- --tag=<version>` |
| 57 | + - `<version>` should be formatted MAJOR.MINOR (ex. `--tag=6.8`) |
| 58 | + - Check the changes with: `npm run preview:docs` |
| 59 | + - Post a PR with the generated docs targeting `main` |
| 60 | + - You may need to stash/rebase depending on where the tag was, see [etc/docs/README.md](etc/docs/README.md) |
| 61 | +1. Announce it! |
| 62 | + - Post an update about the newly released versions to `#nodejs` channel in Slack |
| 63 | + - If releasing the driver, post to the community forums about the new release |
| 64 | + - [Example 6.0.0 post](https://www.mongodb.com/community/forums/t/mongodb-nodejs-driver-6-0-0-released/241691) |
| 65 | + - Copy what was in the release highlights section of your GitHub release post |
| 66 | + - Topic: node-js |
| 67 | + - Category: About the Community Product & Driver Announcements |
| 68 | +1. Mark the [fix version as released in JIRA](https://jira.mongodb.org/projects/NODE?selectedItem=com.atlassian.jira.jira-projects-plugin%3Arelease-page&status=unreleased). |
| 69 | + |
| 70 | +### Authentication |
| 71 | + |
| 72 | +The github action is able to publish with the repository secret `NPM_TOKEN`. |
| 73 | +This is a granular API key that is unique to each package and has to be rotated on a regular basis. |
| 74 | +The `[email protected]` npm account is the author of the automated release. |
| 75 | + |
| 76 | +### Prebuilds |
| 77 | + |
| 78 | +Our native packages offer pre built binaries using [`prebuild`](https://github.com/prebuild/prebuild). |
| 79 | +prebuild uploads archives of the native dependency to the github release. |
| 80 | +`prebuild-install` will handle downloading the correct binary when the package is installed by downstream projects. |
| 81 | +Uploading binaries should happen automatically after the git tag/github release has been made. |
| 82 | +It may take some time for the building and uploading to finish, but no more than a few hours at most. |
| 83 | + |
| 84 | +## Packages |
| 85 | + |
| 86 | +The following is a list of packages the Node.js team is responsible for and these release instructions apply to. |
| 87 | + |
| 88 | +- https://github.com/mongodb/node-mongodb-native |
| 89 | +- https://github.com/mongodb/js-bson |
| 90 | +- https://github.com/mongodb-js/mongodb-client-encryption |
| 91 | +- https://github.com/mongodb-js/kerberos |
| 92 | +- https://github.com/mongodb-js/zstd |
| 93 | +- https://github.com/mongodb-js/nodejs-mongodb-legacy |
| 94 | +- https://github.com/mongodb-js/mongodb-connection-string-url |
| 95 | +- https://github.com/mongodb-js/dbx-js-tools (Node.js team developer tools, not a product) |
0 commit comments