Skip to content

Commit

Permalink
Merge pull request #216 from Turbo87/release-it
Browse files Browse the repository at this point in the history
Add `release-it` to simplify the release process
  • Loading branch information
Turbo87 authored Feb 28, 2021
2 parents cecab85 + 284f7fe commit 92b5857
Show file tree
Hide file tree
Showing 4 changed files with 2,167 additions and 55 deletions.
19 changes: 19 additions & 0 deletions .release-it.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
plugins: {
'release-it-lerna-changelog': {
infile: 'CHANGELOG.md',
},
},
git: {
commitMessage: 'v${version}',
tagAnnotation: 'v${version}',
},
github: {
release: true,
releaseName: 'v${version}',
tokenRef: 'GITHUB_AUTH',
},
npm: {
publish: false,
},
};
56 changes: 56 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Release

Releases are mostly automated using
[release-it](https://github.com/release-it/release-it/) and
[lerna-changelog](https://github.com/lerna/lerna-changelog/).


## Preparation

Since the majority of the actual release process is automated, the primary
remaining task prior to releasing is confirming that all pull requests that
have been merged since the last release have been labeled with the appropriate
`lerna-changelog` labels, and the titles have been updated to ensure they
represent something that would make sense to our users. Some great information
on why this is important can be found at
[keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
guiding principle here is that changelogs are for humans, not machines.

When reviewing merged PR's the labels to be used are:

* breaking - Used when the PR is considered a breaking change.
* enhancement - Used when the PR adds a new feature or enhancement.
* bug - Used when the PR fixes a bug included in a previous release.
* documentation - Used when the PR adds or updates documentation.
* internal - Used for internal changes that still require a mention in the
changelog/release notes.


## Release

Once the prep work is completed, the actual release is straight forward:

* First, ensure that you have an environment variable with your GitHub token
setup as `GITHUB_AUTH`. This token will be used for generating your changelog
(unauthenticated requests to the GitHub API are heavily throttled) and for
creating the GitHub release. Only "repo" access is needed; no "admin"
or other scopes are required.

* Next, ensure that you have installed your projects dependencies:

```
yarn install
```

* And last (but not least 😁) do your release:

```
yarn release
```

[release-it](https://github.com/release-it/release-it/) manages the actual
release process. It will prompt you to choose the version number after which
you will have the chance to hand tweak the changelog to be used (for the
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
pushing the tag and commits, etc. Finally, GitHub Actions will build the commit
and push the release to npm.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"build": "tsc",
"prepublish": "tsc",
"lint": "tslint --project . --format stylish",
"release": "release-it",
"test": "jest",
"test:watch": "jest --watchAll --notify"
},
Expand All @@ -27,6 +28,8 @@
"@types/node": "6.14.13",
"igc-filename-parser": "0.1.1",
"jest": "26.6.3",
"release-it": "14.4.1",
"release-it-lerna-changelog": "3.1.0",
"ts-jest": "26.5.2",
"tslint": "5.20.1",
"typescript": "4.2.2"
Expand Down
Loading

0 comments on commit 92b5857

Please sign in to comment.