Read the docs for what to do before publishing a release to ensure you are prepared to publish.
See the documentation on support branches if you need to:
- publish a new release of previous major versions of GOV.UK Frontend
- publish a ‘hotfix’ release of GOV.UK Frontend without including other unreleased changes on the
main
branch
Developers should pair on releases. When remote working, it can be useful to be on a call together.
-
Check out the main branch and pull the latest changes.
-
Ensure you're running the version of NodeJS matching
.nvmrc
.- If you use NVM, run
nvm use
to set up the right version - If you use another management system (like
asdf
), compare the output ofnode --version
and install the right one if necessary
- If you use NVM, run
-
Run
npm ci
to make sure you have the exact dependencies installed. -
Pick a new version number according to the versioning documentation and apply it by running:
npm version <NEW VERSION NUMBER> --no-git-tag-version --workspace govuk-frontend
This step will update
govuk-frontend
'spackage.json
and projectpackage-lock.json
files.Do not commit the changes.
-
Create and check out a new branch (
release-[version]
)git switch -c "release-$(npm run version --silent --workspace govuk-frontend)"
-
Update the
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, regroup the content under those headings in a single block
- saving your changes
-
Run
npm run build-release
to:- build GOV.UK Frontend into the package's
/dist
and root/dist
directories - commit the changes
- push a branch to GitHub
You will now be prompted to continue or cancel. Check the details and enter
y
to continue. If something does not look right, pressN
to cancel the build and creation of the branch on GitHub. - build GOV.UK Frontend into the package's
-
Create a pull request and copy the changelog text. When reviewing the PR, check that the version numbers have been updated and that the compiled assets use this version number.
-
Once a reviewer approves the pull request, merge it to main.
-
Check out the main branch and pull the latest changes.
-
Sign in to npm (
npm login
), using the credentials for the govuk-patterns-and-tools npm user from Bitwarden. -
Run
npm run publish-release
, which will prompt you to check whether the npm tag looks as expected.If you're following these instructions, you're probably doing a sequential release, meaning the tag should be 'latest'.
-
Enter
y
to continue. If you think the tag should be different, enterN
to have the option to set your own npm tag. -
You will now be prompted to continue or cancel the release. Check the details and enter
y
to continue. If something does not look right, pressN
to cancel the release.This step will create a ZIP file containing the release in the root of your govuk-frontend git directory. You will need this file when creating the GitHub release.
This step will also automatically create a tag in Github which you can use to create a Github release in the following section.
-
Verify the presence of the release and its tag on npm
If the release has been assigned the wrong tag (mistakes happen), you can use
npm dist-tag
to quickly correct. -
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 https://npmjs.com there as well.
To create a new GitHub release, do the following:
- Select the tag corresponding to the release in the list of tags on GitHub
- Press Create release from tag
- Set 'GOV.UK Frontend v[version]' as the title
- Add release notes from
CHANGELOG.md
- Attach as release binary the ZIP file that has been generated at the root of this project during the npm publishing phase
- Publish release
Read the docs for what to do after publishing a release.