diff --git a/.gitignore b/.gitignore index d8ccb9e4037..1d581f29fc9 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,6 @@ packages/**/package-lock.json docs .nyc_output + +#lerna +.changelog diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e822e2944a5..36e5c033fe9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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). diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 00000000000..a2073a8fee2 --- /dev/null +++ b/RELEASING.md @@ -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= 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. diff --git a/lerna.json b/lerna.json index 0c5a09ee5e1..ceb0a281519 100644 --- a/lerna.json +++ b/lerna.json @@ -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" + } } diff --git a/package.json b/package.json index bb9f79fa379..0b7e5518f4d 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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": {