Skip to content

Commit 6b344ad

Browse files
committed
Add release action
1 parent 972acc0 commit 6b344ad

File tree

5 files changed

+295
-222
lines changed

5 files changed

+295
-222
lines changed

.github/actions/setup/action.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Setup
2+
description: Setup Node.js and install dependencies
3+
inputs:
4+
node-version:
5+
description: Node version
6+
required: false
7+
default: '24'
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Install pnpm
13+
uses: pnpm/[email protected]
14+
15+
- name: Setup Node.js ${{ inputs.node-version }}
16+
uses: actions/[email protected]
17+
with:
18+
node-version: ${{ inputs.node-version }}
19+
registry-url: 'https://registry.npmjs.org'
20+
cache: pnpm
21+
22+
- name: Install dependencies
23+
run: pnpm install
24+
shell: bash

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Release & Publish to NPM & GitHub
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
increment:
6+
description: 'Increment type: major, minor, patch, pre...'
7+
required: true
8+
type: choice
9+
options:
10+
- patch
11+
- minor
12+
- major
13+
- prepatch
14+
- preminor
15+
- premajor
16+
default: patch
17+
18+
jobs:
19+
release:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/[email protected]
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Setup
28+
uses: ./.github/actions/setup
29+
30+
- name: Import GPG key
31+
id: import-gpg
32+
uses: crazy-max/[email protected]
33+
with:
34+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
35+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
36+
git_user_signingkey: true
37+
git_commit_gpgsign: true
38+
39+
- run: pnpm run release --increment ${{github.event.inputs.increment}} --ci
40+
env:
41+
# For release-it
42+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
NPM_CONFIG_PROVENANCE: true
45+
# For lerna-changelog
46+
IGNORE_PEER_DEPENDENCIES: release-it
47+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
48+
49+
permissions:
50+
contents: write
51+
id-token: write

.release-it.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
},
99
"plugins": {
1010
"@release-it-plugins/lerna-changelog": {
11-
"infile": "CHANGELOG.md"
11+
"infile": "CHANGELOG.md",
12+
"launchEditor": false
1213
}
1314
}
1415
}

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"typecheck": "tsc --noEmit",
9393
"lint": "eslint .",
9494
"prepare": "husky",
95-
"release": "dotenv -- release-it"
95+
"release": "release-it"
9696
},
9797
"peerDependencies": {
9898
"@fluent/bundle": "*",
@@ -115,18 +115,17 @@
115115
"@fluent/bundle": "^0.18.0",
116116
"@nuxt/kit": "^3.15.4",
117117
"@nuxt/schema": "^3.15.4",
118-
"@release-it-plugins/lerna-changelog": "7.0.0",
118+
"@release-it-plugins/lerna-changelog": "^7.0.0",
119119
"@types/node": "22.13.5",
120120
"@vitejs/plugin-vue": "5.2.1",
121121
"@vitest/coverage-istanbul": "^3.0.6",
122122
"@vue/compiler-sfc": "3.5.13",
123-
"dotenv-cli": "8.0.0",
124123
"eslint": "9.21.0",
125124
"execa": "9.5.2",
126125
"husky": "9.1.7",
127126
"lint-staged": "15.4.3",
128127
"memfs": "4.17.0",
129-
"release-it": "19.0.2",
128+
"release-it": "^19.0.3",
130129
"tsup": "8.3.6",
131130
"typescript": "5.7.3",
132131
"vite": "6.1.1",
@@ -137,7 +136,9 @@
137136
},
138137
"lint-staged": {
139138
"*.js": "eslint --fix",
140-
"*.ts?(x)": "eslint --fix"
139+
"*.ts?(x)": "eslint --fix",
140+
"*.json": "eslint --fix",
141+
"*.md": "eslint --fix"
141142
},
142143
"changelog": {
143144
"labels": {

0 commit comments

Comments
 (0)