Skip to content

Commit 1f149e0

Browse files
committed
Set up release-it
1 parent d191a8a commit 1f149e0

10 files changed

Lines changed: 2355 additions & 29 deletions

File tree

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dist
2020
dist-ssr
2121
*.local
2222
.eslintcache
23+
.npmrc
2324

2425
# Editor directories and files
2526
.vscode/*

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release & Publish to NPM
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
release:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
with:
11+
fetch-depth: 0
12+
13+
- uses: pnpm/action-setup@v2
14+
with:
15+
version: 7
16+
run_install: false
17+
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 18
21+
cache: 'pnpm'
22+
23+
- run: pnpm install --frozen-lockfile
24+
25+
- run: pnpm lint
26+
27+
- run: pnpm build
28+
29+
- run: pnpm test
30+
31+
- name: git config
32+
run: |
33+
git config user.name "${GITHUB_ACTOR}"
34+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
35+
36+
- name: pnpm config
37+
run: pnpm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
38+
env:
39+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
41+
- run: pnpm release --ci
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dist
1212
dist-ssr
1313
*.local
1414
.eslintcache
15+
.npmrc
1516

1617
# Editor directories and files
1718
.vscode/*

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dist
2020
dist-ssr
2121
*.local
2222
.eslintcache
23+
.npmrc
2324

2425
# Editor directories and files
2526
.vscode/*

.release-it.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"plugins": {
3+
"@release-it-plugins/lerna-changelog": {
4+
"infile": "CHANGELOG.md",
5+
"launchEditor": false
6+
}
7+
},
8+
"git": {
9+
"tagName": "v${version}",
10+
"commitMessage": "internal: release v${version}"
11+
},
12+
"github": {
13+
"release": true
14+
}
15+
}

CHANGELOG.md

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

LICENSE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# The MIT License (MIT)
2+
3+
Copyright (c) 2022
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

RELEASE.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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 remaining task prior to releasing is confirming that all pull requests that have been merged since the last release:
10+
11+
- [ ] have been labeled with the appropriate `lerna-changelog` labels (see below) and
12+
- [ ] have titles that represent something that would make sense to our users.
13+
14+
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.
15+
16+
When reviewing merged PR's the labels to be used are:
17+
18+
- breaking - Used when the PR is considered a breaking change.
19+
- enhancement - Used when the PR adds a new feature or enhancement.
20+
- bug - Used when the PR fixes a bug included in a previous release.
21+
- documentation - Used when the PR adds or updates documentation.
22+
- internal - Used for internal changes that still require a mention in the changelog/release notes.
23+
24+
## Release
25+
26+
Once the prep work is completed, the actual release is straight forward:
27+
28+
- First, ensure that you have obtained a [GitHub personal access token][generate-token] with the `repo` scope (no other permissions are needed). Make sure the token is available as the `GITHUB_TOKEN` environment variable.
29+
30+
For instance:
31+
32+
```bash
33+
export GITHUB_TOKEN=abc123def456
34+
```
35+
36+
[generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_TOKEN+env+variable
37+
38+
- Then do your release. If you're nervous, try `pnpm release:debug` first.
39+
40+
```sh
41+
pnpm release
42+
```
43+
44+
[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, deploying the docs, etc.

package.json

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
11
{
22
"name": "prettier-plugin-ember-template-tag",
3-
"private": true,
43
"version": "0.0.0",
5-
"type": "module",
4+
"description": "A prettier plugin for formatting Ember template tags",
5+
"keywords": [
6+
"prettier",
7+
"ember",
8+
"template tag",
9+
"gts",
10+
"gjs"
11+
],
12+
"author": {
13+
"email": "kmenne@gmail.com",
14+
"name": "Krystan HuffMenne"
15+
},
16+
"type": "commonjs",
617
"main": "dist/prettier-plugin-ember-template-tag.cjs",
18+
"license": "MIT",
19+
"repository": {
20+
"type": "git",
21+
"url": "git@github.com:gitKrystan/prettier-plugin-ember-template-tag.git"
22+
},
23+
"homepage": "https://github.com/gitKrystan/prettier-plugin-ember-template-tag",
24+
"bugs": {
25+
"url": "https://github.com/gitKrystan/prettier-plugin-ember-template-tag/issues"
26+
},
27+
"publishConfig": {
28+
"registry": "https://registry.npmjs.org"
29+
},
730
"scripts": {
831
"dev": "vite",
932
"build": "tsc && vite build",
@@ -16,12 +39,21 @@
1639
"lint:prettier": "prettier --check .",
1740
"lint:prettier:fix": "prettier --write .",
1841
"lint:ts": "tsc --project tsconfig.lint.json",
42+
"release": "release-it",
43+
"release:debug": "release-it --verbose --dry-run",
1944
"test": "vitest",
2045
"test:ui": "vitest --ui",
2146
"test:run": "vitest run"
2247
},
48+
"dependencies": {
49+
"@babel/core": "^7.19.6",
50+
"ember-cli-htmlbars": "^6.1.1",
51+
"ember-template-imports": "^3.3.1",
52+
"prettier": "^2.7.1"
53+
},
2354
"devDependencies": {
2455
"@babel/types": "^7.20.0",
56+
"@release-it-plugins/lerna-changelog": "^5.0.0",
2557
"@types/babel__core": "^7.1.19",
2658
"@types/prettier": "^2.7.1",
2759
"@typescript-eslint/eslint-plugin": "^5.42.0",
@@ -32,14 +64,9 @@
3264
"eslint-plugin-jsdoc": "^39.6.0",
3365
"npm-run-all": "^4.1.5",
3466
"prettier-plugin-jsdoc": "^0.4.2",
67+
"release-it": "^15.5.0",
3568
"typescript": "^4.8.4",
3669
"vite": "^3.2.2",
3770
"vitest": "^0.24.5"
38-
},
39-
"dependencies": {
40-
"@babel/core": "^7.19.6",
41-
"ember-cli-htmlbars": "^6.1.1",
42-
"ember-template-imports": "^3.3.1",
43-
"prettier": "^2.7.1"
4471
}
4572
}

0 commit comments

Comments
 (0)