Skip to content

Commit

Permalink
chore(lerna): add lerna-changelog (open-telemetry#432)
Browse files Browse the repository at this point in the history
* chore(lerna): add lerna-changelog

closes open-telemetry#372
add docs related to lerna-changelog

Signed-off-by: Olivier Albertini <olivier.albertini@montreal.ca>

* fix: add draffensperger recommendations

Signed-off-by: Olivier Albertini <olivier.albertini@montreal.ca>
  • Loading branch information
OlivierAlbertini authored and mayurkale22 committed Oct 16, 2019
1 parent 4c0626c commit ddf43ff
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@ packages/**/package-lock.json
docs

.nyc_output

#lerna
.changelog
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ The `opentelemetry-js` project is written in TypeScript.
- `yarn test` or `npm test` tests code the same way that our CI will test it.
- `yarn fix` or `npm run fix` lint (and maybe fix) any changes.
- `yarn docs` or `npm run docs` to generate API documentation.
- `yarn changelog` or `npm run changelog` to generate CHANGELOG documentation in your terminal (see [RELEASING.md](RELEASING.md) for more details).
43 changes: 43 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Releasing OpenTelemetry Packages (for Maintainers Only)

This document explains how to publish all OT modules at version x.y.z. Ensure that you’re following semver when choosing a version number.

## Use the Changelog to create a GitHub Release

### Generate the changelog with lerna

Since we use `lerna`, we can use [lerna-changelog](https://github.com/lerna/lerna-changelog#lerna-changelog)

#### How to use
Pass your [github token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) to generate the changelog automatically.
For security reasons, when you create a Github token, select the permissions: under **repo**, select **Access public repositories**, **commit status**.

In your terminal, execute the following command:
```bash
GITHUB_AUTH=<your token> lerna-changelog
```
It will print something like:

```md
## Unreleased (2018-05-24)

#### :bug: Bug Fix
* [#198](https://github.com/my-org/my-repo/pull/198) Avoid an infinite loop ([@helpful-hacker](https://github.com/helpful-hacker))

#### :house: Internal
* [#183](https://github.com/my-org/my-repo/pull/183) Standardize error messages ([@careful-coder](https://github.com/careful-coder))

#### Commiters: 2
- Helpful Hacker ([@helpful-hacker](https://github.com/helpful-hacker))
- [@careful-coder](https://github.com/careful-coder)
```
By default lerna-changelog will show all pull requests that have been merged since the latest tagged commit in the repository. That is however only true for pull requests **with certain labels applied** (see [lerna.json](lerna.json) for authorized labels).

You can also use the `--from` and `--to` options to view a different range of pull requests:
```
GITHUB_AUTH=xxxxx lerna-changelog --from=v1.0.0 --to=v2.0.0
```

#### Update Changelog file

From what `lerna-changelog` has generated, starts new Unreleased label. Follow the example set by recent Released label.
14 changes: 13 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,17 @@
"packages/*",
"examples/*"
],
"version": "0.1.0"
"version": "0.1.0",
"changelog": {
"repo": "open-telemetry/opentelemetry-js",
"labels": {
"breaking": ":boom: Breaking Change",
"enhancement": ":rocket: (Enhancement)",
"bug": ":bug: (Bug Fix)",
"core": ":wrench: Core",
"document": ":books: (Refine Doc)",
"feature-request": ":sparkles: (Feature)"
},
"cacheDir": ".changelog"
}
}
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"bump": "lerna publish",
"codecov": "lerna run codecov",
"codecov:browser": "lerna run codecov:browser",
"changelog": "lerna-changelog",
"check": "lerna run check",
"predocs-test": "yarn docs",
"docs-test": "lerna run docs-test",
Expand All @@ -31,12 +32,13 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"devDependencies": {
"@commitlint/cli": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"husky": "^3.0.1",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"husky": "^3.0.9",
"gts": "^1.0.0",
"lerna": "^3.13.4",
"typescript": "^3.6.3"
"lerna": "^3.17.0",
"lerna-changelog": "^0.8.2",
"typescript": "^3.6.4"
},
"husky": {
"hooks": {
Expand Down

0 comments on commit ddf43ff

Please sign in to comment.