Skip to content

Commit d103bfa

Browse files
committed
Setup release-it and ci publishing
1 parent a4422e9 commit d103bfa

5 files changed

Lines changed: 1550 additions & 77 deletions

File tree

.github/workflows/ci-build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,28 @@ jobs:
6464
run: yarn install --frozen-lockfile
6565
- name: test
6666
run: node_modules/.bin/ember try:one ${{ matrix.ember-try-scenario }} --skip-cleanup
67+
68+
publish:
69+
name: Publish to npm
70+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v2
75+
76+
- name: Install node
77+
uses: actions/setup-node@v2
78+
with:
79+
node-version: 14.x
80+
registry-url: 'https://registry.npmjs.org'
81+
82+
- name: install dependencies
83+
run: yarn install --frozen-lockfile
84+
85+
- name: auto-dist-tag
86+
run: npx auto-dist-tag@1 --write
87+
88+
- name: publish to npm
89+
run: npm publish
90+
env:
91+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Changelog

RELEASE.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Release Process
2+
3+
Releases are mostly automated using
4+
[release-it](https://github.com/release-it/release-it/) and
5+
[lerna-changelog](https://github.com/lerna/lerna-changelog/).
6+
7+
## Preparation
8+
9+
Since the majority of the actual release process is automated, the primary
10+
remaining task prior to releasing is confirming that all pull requests that
11+
have been merged since the last release have been labeled with the appropriate
12+
`lerna-changelog` labels and the titles have been updated to ensure they
13+
represent something that would make sense to our users. Some great information
14+
on why this is important can be found at
15+
[keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
16+
guiding principle here is that changelogs are for humans, not machines.
17+
18+
When reviewing merged PR's the labels to be used are:
19+
20+
* breaking - Used when the PR is considered a breaking change.
21+
* enhancement - Used when the PR adds a new feature or enhancement.
22+
* bug - Used when the PR fixes a bug included in a previous release.
23+
* documentation - Used when the PR adds or updates documentation.
24+
* internal - Used for internal changes that still require a mention in the
25+
changelog/release notes.
26+
27+
## Release
28+
29+
Once the prep work is completed, the actual release is straight forward:
30+
31+
* First, ensure that you have installed your projects dependencies:
32+
33+
```sh
34+
yarn install
35+
```
36+
37+
* Second, ensure that you have obtained a
38+
[GitHub personal access token][generate-token] with the `repo` scope (no
39+
other permissions are needed). Make sure the token is available as the
40+
`GITHUB_AUTH` environment variable.
41+
42+
For instance:
43+
44+
```bash
45+
export GITHUB_AUTH=abc123def456
46+
```
47+
48+
[generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable
49+
50+
* And last (but not least 😁) do your release.
51+
52+
```sh
53+
npx release-it
54+
```
55+
56+
[release-it](https://github.com/release-it/release-it/) manages the actual
57+
release process. It will prompt you to to choose the version number after which
58+
you will have the chance to hand tweak the changelog to be used (for the
59+
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
60+
pushing the tag and commits, etc.

package.json

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
"test:ember": "ember test",
2828
"test:ember-compatibility": "ember try:each",
2929
"test-typings": "node node_modules/typescript/bin/tsc",
30+
"prepack": "yarn babel --extensions '.ts' --presets @babel/preset-typescript addon --out-dir addon/ --ignore '**/*.d.ts'",
3031
"postpack": "rimraf addon/**/*.js",
31-
"postpublish": "npm-run-all clean",
32-
"prepack": "yarn babel --extensions '.ts' --presets @babel/preset-typescript addon --out-dir addon/ --ignore '**/*.d.ts'"
32+
"postpublish": "npm-run-all clean"
3333
},
3434
"dependencies": {
3535
"ember-cli-babel": "^7.26.6"
@@ -81,19 +81,42 @@
8181
"prettier": "^2.3.2",
8282
"qunit": "^2.16.0",
8383
"qunit-dom": "^2.0.0",
84+
"release-it": "^14.2.1",
85+
"release-it-lerna-changelog": "^3.1.0",
8486
"rimraf": "^3.0.2",
8587
"typescript": "^4.3.5",
8688
"webpack": "^5"
8789
},
8890
"engines": {
8991
"node": "12.* || 14.* || >= 16"
9092
},
93+
"publishConfig": {
94+
"registry": "https://registry.npmjs.org"
95+
},
9196
"ember": {
9297
"edition": "octane"
9398
},
9499
"ember-addon": {
95100
"configPath": "tests/dummy/config"
96101
},
102+
"release-it": {
103+
"plugins": {
104+
"release-it-lerna-changelog": {
105+
"infile": "CHANGELOG.md",
106+
"launchEditor": true
107+
}
108+
},
109+
"git": {
110+
"tagName": "v${version}"
111+
},
112+
"github": {
113+
"release": true,
114+
"tokenRef": "GITHUB_AUTH"
115+
},
116+
"npm": {
117+
"publish": false
118+
}
119+
},
97120
"volta": {
98121
"node": "12.22.3",
99122
"yarn": "1.22.11"

0 commit comments

Comments
 (0)