Skip to content

Commit

Permalink
Add automated release setup.
Browse files Browse the repository at this point in the history
* Add `release-it`, `release-it-lerna-changelog`, and
  `release-it-yarn-workspaces` (and configuration).
* Remove bespoke `bin/publish.js` in favor of using shared logic in
  [release-it-yarn-workspaces](https://github.com/rwjblue/release-it-yarn-workspaces)
* Remove custom `changelog` `package.json` script (no longer needed)

release-it configuration explanation:

* `hooks.before:bump` ensures that we build before publishing
* `release-it-lerna-changelog` runs `lerna-changelog` prompts (with
  $EDITOR) for manual tweaks/changes then prepends to CHANGELOG.md.
* `release-it-yarn-workspaces` uses a bit of a non-standard publishing
  setup because the packages in this repo actually _publish_ from
  `dist/` (**not** from the configured yarn workspaces). In order to
  accomplish that (and ensure everything else is updated) we have to
  override defaults for:
  * `workspaces` to specify the workspaces in `dist/` instead of
    `packages/`
  * `additionalManifests.dependencyUpdates` to ensure the source
    packages in the repo (in `packages/*/*`) are updated to depend
    on the latest versions of our own packages.
  * `additionalManifests.versionUpdates` to ensure the source
    packages in the repo (in `packages/*/*`) are updated to the
    latest versions.
  • Loading branch information
rwjblue committed Apr 3, 2020
1 parent d16f573 commit 9fbff13
Show file tree
Hide file tree
Showing 4 changed files with 1,408 additions and 720 deletions.
67 changes: 67 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# 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 `release-it` installed globally, generally done by
using one of the following commands:

```
# using https://volta.sh
volta install release-it
# using Yarn
yarn global add release-it
# using npm
npm install --global release-it
```

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

```
yarn install
```

* And last (but not least 😁) do your release. It requires a
[GitHub personal access token](https://github.com/settings/tokens) as
`$GITHUB_AUTH` environment variable. Only "repo" access is needed; no "admin"
or other scopes are required.

```
export GITHUB_AUTH="f941e0..."
release-it
```

[release-it](https://github.com/release-it/release-it/) manages the actual
release process. It will prompt you to 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.
253 changes: 0 additions & 253 deletions bin/publish.js

This file was deleted.

42 changes: 39 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"build": "ember build --env production --suppress-sizes",
"build:flags": "RETAIN_FLAGS=true ember build --env production --suppress-sizes",
"build:typecheck": "tsc -p tsconfig.json --noEmit --pretty false",
"changelog": "lerna-changelog",
"eslint": "eslint . --cache --ext .js,.ts",
"link:local": "node bin/yarn-link-local",
"problems": "tsc -p tsconfig.json --noEmit --pretty false",
Expand Down Expand Up @@ -78,12 +77,14 @@
"execa": "^1.0.0",
"glob": "^7.0.5",
"js-yaml": "^3.10.0",
"lerna-changelog": "^0.8.2",
"loader.js": "^4.0.10",
"mkdirp": "^0.5.1",
"prettier": "^1.19.1",
"qunit": "^2.9.3",
"qunit-tap": "^1.5.1",
"release-it": "^13.5.1",
"release-it-lerna-changelog": "^2.1.2",
"release-it-yarn-workspaces": "^1.3.0",
"rimraf": "^2.7.1",
"rollup": "^1.31.1",
"rollup-plugin-sourcemaps": "^0.5.0",
Expand All @@ -92,6 +93,9 @@
"toml": "^3.0.0",
"typescript": "3.7.5"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"changelog": {
"repo": "glimmerjs/glimmer-vm",
"labels": {
Expand All @@ -102,8 +106,40 @@
"internal": ":house: Internal"
}
},
"release-it": {
"hooks": {
"before:bump": "yarn build"
},
"plugins": {
"release-it-lerna-changelog": {
"infile": "CHANGELOG.md",
"launchEditor": true
},
"release-it-yarn-workspaces": {
"workspaces": [
"dist/@glimmer/*"
],
"additionalManifests": {
"dependencyUpdates": [
"packages/*/*/package.json"
],
"versionUpdates": [
"packages/*/*/package.json"
]
}
}
},
"git": {
"tagName": "v${version}"
},
"github": {
"release": true,
"tokenRef": "GITHUB_AUTH"
},
"npm": false
},
"volta": {
"node": "10.16.3",
"yarn": "1.17.3"
}
}
}
Loading

0 comments on commit 9fbff13

Please sign in to comment.