From 514a527936e9d5d0ebb3a66411806aa0ed071877 Mon Sep 17 00:00:00 2001 From: Romaric Pascal Date: Fri, 19 Apr 2024 15:11:48 +0100 Subject: [PATCH] Align release process with that of GOV.UK Frontend - add extra details to the steps - makes process more in line with our other repos --- CONTRIBUTING.md | 96 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 68 insertions(+), 28 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 48f253f3..8c01a67b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -117,45 +117,85 @@ git push --no-verify - Updates to the README.md when necessary - A 1 line update in CHANGELOG.md describing your changes -## Cutting a new release +## Publishing a new version of accessible-autocomplete -`git pull --rebase` and then run: +### Tagging a new release on GitHub -```bash -git checkout -b "v1.2.3" -vim CHANGELOG.md # Update CHANGELOG, put all unreleased changes under new heading. -git commit -am "Update CHANGELOG" -npm version -m "## 1.2.3 - 2017-01-13 - -- Change included in this release -- Another change included in this release" +1. Check out the **main** branch and pull the latest changes. ``` -Then run: -```bash -git push --tags --set-upstream origin refs/heads/v1.2.3:refs/heads/v1.2.3 -``` +2. Ensure you're running the version of NodeJS matching [`.nvmrc`](/.nvmrc). + + - If you use NVM, run `nvm use` to set up the right version + - If you use another management system (like [`asdf`](https://asdf-vm.com/guide/getting-started.html)), compare the output of `node --version` and install the right one if necessary + +3. Run `npm ci` to make sure you have the exact dependencies installed. + +4. Pick a new version number according to the [versioning documentation](/docs/contributing/versioning.md) and apply it by running: + + ```shell + npm version --no-git-tag-version --workspace govuk-frontend + ``` + + This step will update [`govuk-frontend`'s `package.json`](/packages/govuk-frontend/package.json) and project [`package-lock.json`](/package-lock.json) files. + + Do not commit the changes. -Create a pull request for the release and merge once it has been approved, then run: +5. Create and check out a new branch (`release-[version]`) + + ```shell + git switch -c "release-$(npm run version --silent --workspace govuk-frontend)" + +6. Update the [`CHANGELOG.md`](/CHANGELOG.md) by: + + - changing the 'Unreleased' heading to the new version number and release type. For example, '3.11.0 (Feature release)' + - adding a new 'Unreleased' heading above the new version number and release type, so users will know where to add PRs to the changelog + - if the changelog has headings from [pre-releases](/docs/releasing/publishing-a-pre-release.md#publish-a-new-version-of-govuk-frontend), regroup the content under those headings in a single block + - saving your changes + +7. Commit the changes and push them to GitHub ```bash -git checkout main -git pull --rebase +git commit -m "Release v$(npm run version --silent --workspace govuk-frontend)" +git tag "v$(npm run version --silent --workspace govuk-frontend)" +git push --tags ``` -### Publish the release +8. Create a pull request and copy the changelog text. + When reviewing the PR, check that the version numbers have been updated. + +9. Once a reviewer approves the pull request, merge it to **main**. + +### Publish the release to npm + +1. Check out the **main** branch and pull the latest changes. +2. Sign in to npm (`npm login`), using the credentials for the govuk-patterns-and-tools npm user from Bitwarden. +3. Run `npm publish` to publish to npm. +4. Verify the presence of the release and its tag on [npm](https://www.npmjs.com/package/accessible-autocomplete?activeTab=versions) +5. Run `npm logout` to log out from npm in the command line. If you've logged in through your browser, remember to log out from there as well. + +### Create a new release on GitHub + +To create a new GitHub release, do the following: + +1. Select the tag corresponding to the release in [the list of tags on GitHub](https://github.com/alphagov/govuk-frontend/tags) +2. Press **Create release from tag** +3. Set `v` as the title +4. Add release notes from [`CHANGELOG.md`](/CHANGELOG.md) +5. Publish release - 1. Sign in to npm (`npm login`) as `govuk-patterns-and-tools` using the credentials from BitWarden. - 2. Run `npm publish` to publish to npm. - 3. Open the ['create a new release' dialog](https://github.com/alphagov/accessible-autocomplete/releases/new) on GitHub. - 4. Select the latest tag version. - 5. Set 'v[VERSION-NUMBER]' as the title. - 6. Add the release notes from the changelog. - 7. Add a summary of highlights. - 8. Select **Publish release**. + You do not need to manually attach source code files to the release on GitHub. -You do not need to manually attach source code files to the release on GitHub. +### Announce the new release Post a short summary of the release in the cross-government and GDS #govuk-design-system Slack channels. For example: -🚀 We’ve just released Accessible Autocomplete v2.0.1. You can now use the acccessible autocomplete multiple times on one page. Thanks to @ and @ for helping with this release. [https://github.com/alphagov/accessible-autocomplete/releases/tag/v2.0.1](https://github.com/alphagov/accessible-autocomplete/releases/tag/v2.0.1) +> 🚀 We’ve just released Accessible Autocomplete v\. +> +> * Summary of change 1 +> * Summary of change 2 +> * ... +> +> You can find more details about these changes in [the release’s changelog](https://github.com/alphagov/accessible-autocomplete/releases/tag/v), including how to adjust to the breaking changes. +> +> Thanks to @\ and @\ for helping with this release.