Note: These steps should be done directly in the pinterest/ktlint repository, not in your personal fork.
- Create a new branch (e.g.
0.50.0-prep) - Manually run GitHub Action workflow https://github.com/pinterest/ktlint/actions/workflows/generate-changelog.yml to generate the new changelog based on the PR's since last release
- Check whether each PR is listed in the correct category. If not, add the proper label to the PR and repeat. See https://github.com/pinterest/ktlint/blob/master/.github/workflows/generate-changelog.yml#L35 for which labels to use.
- Copy the generated changelog from build step
Echo generated changelogto theCHANGELOG.mdfile - The generated changelog only contains the PR titles. For most changes this should be sufficient. For breaking API changes, it is better to add additional information. To indent this explanation correctly, append
(two spaces) to the end of the previous line.
- Update
VERSION_NAMEwith the new release version in the project rootgradle.properties. Be sure to remove-SNAPSHOT. - Update
CHANGELOG.mdto rename theUnreleasedsection to the new release name, following the## [x.x.x] - YYYY-MM-DDformat. - Add the new release to the bottom of the
CHANGELOG.mdfile. - Push your changes to the branch, and merge it to
master. - Update your local
pinterest/ktlintmasterbranch; verify you see thegradle.propertiesandCHANGELOG.mdchanges locally. - Add a tag with the new release version, and push it directly to remote (e.g.
git tag 0.50.0 && git push origin 0.50.0). This will kick off the Release workflow.Important: when you get an error likeHttpError: refusing to allow a Personal Access Token to create or update workflow '.github/workflows/automerge-triggers.yml' without 'workflow' scope, the GitHub personal access token is most likely expired. When this happens on the bump of the Homebrew formula, the personal access token of @shashachu needs to be updated. - Close and release the repo on Sonatype. Only Pinterest employees can do this. Wait with steps below until artifacts are published on https://central.sonatype.com/search?q=com.pinterest.ktlint&sort=published
- The
.announcescript has created the<release>-update-refsbranch in the repo. Create a new pull request (https://github.com/pinterest/ktlint/compare) and merge it to master. - Merge of branch
<release>-update-refsto master starts thePublish release documentationandPublish snapshot documentationworkflows. Check that both workflows succeed (https://github.com/pinterest/ktlint/actions). Also check that the documentation has actually been published on https://pinterest.github.io/ktlint/latest. - Verify that documentation of new release is published correctly. Especially check whether version numbers in documentation have been changed. After publication of
1.0.0the documentation still referred to0.50.0(according to https://github.com/pinterest/ktlint/actions/runs/6085301212/job/16509057702#step:11:14 it tried updating0.49.1to1.0.0which most likely was caused by the already fixed issue that the changelog heading of the0.50.0did not comply to the expected format). - Verify that the published documentation does not contain broken links with Broken Link Checker Tool.
- Announce release on Ktlint Slack channel but wait with doing so until sonatype release is closed by Pinterest.
- Update
gradle.propertieswith the newSNAPSHOTversion
Sometimes it can happen that after a minor release, it is required to release a patch version on an older minor version as well. For example after releasing ktlint 1.8.0 and Ktlint IntelliJ Plugin 0.30.x it turned out that starting from that version the 1.7.0 and 1.7.1 are no longer compatible with the plugin version 0.30 and above. This is blocking issue for users who can not upgrade from ktlint 1.7.x to 1.8.x or higher.
For problem above, the following steps resulted in a new 1.7.2 release being published on Maven after 1.8.0 was released:
- Create branch
master-1.7.xfrom tag1.7.1- Via cherry-picking add commits to the branch that need to be published in the
1.7.2release. - Push the branch. Do not create a merge request as this branch is not going to be merged into master.
- Via cherry-picking add commits to the branch that need to be published in the
- On normal
masterbranch change thepublish-release-build.ymlfile as follows:- Restrict the tag that is accepted for this release:
on: push: tags: - '1.7.2'
- Change the reference in the
actions/checkout:- uses: actions/checkout with: ref: 'master-1.7.x'
- Comment out all steps (except publication to Maven Central).
- Push the branch, and merge to master.
- Like normal, add a tag with the new release version, and push it directly to remote (e.g.
git tag 1.7.2 && git push origin 1.7.2). This will kick off the Release workflow. Important: when you get an error likeHttpError: refusing to allow a Personal Access Token to create or update workflow '.github/workflows/automerge-triggers.yml' without 'workflow' scope, the GitHub personal access token is most likely expired. When this happens on the bump of the Homebrew formula, the personal access token of @shashachu needs to be updated. - Close and release the repo on Sonatype. Only Pinterest employees can do this. Wait with steps below until artifacts are published on https://central.sonatype.com/search?q=com.pinterest.ktlint&sort=published
- Revert the changes in
publish-release-build.yml. Push the branch, and merge to master.
- Restrict the tag that is accepted for this release: