Skip to content

Commit 9ab83cf

Browse files
authored
Set up release workflow and NPM provenance (#128)
1 parent 67f610d commit 9ab83cf

File tree

6 files changed

+924
-445
lines changed

6 files changed

+924
-445
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

.github/workflows/test.yml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@ jobs:
1616
strategy:
1717
matrix:
1818
os: [ubuntu-latest, windows-latest]
19-
node: [20, 22]
19+
node: [22, 24]
2020
steps:
2121
- name: Checkout
2222
uses: actions/[email protected]
23-
- name: Setup Node.js ${{ matrix.node }}
24-
uses: actions/setup[email protected]
23+
- name: Setup
24+
uses: ./.github/actions/setup
2525
with:
2626
node-version: ${{ matrix.node }}
27-
- uses: pnpm/[email protected]
28-
with:
29-
run_install: true
3027

3128
- name: Test
3229
run: pnpm test:coverage
@@ -40,11 +37,8 @@ jobs:
4037
steps:
4138
- name: Checkout
4239
uses: actions/[email protected]
43-
- name: Setup Node.js
44-
uses: actions/[email protected]
45-
- uses: pnpm/[email protected]
46-
with:
47-
run_install: true
40+
- name: Setup
41+
uses: ./.github/actions/setup
4842

4943
- name: Lint
5044
run: pnpm lint
@@ -55,11 +49,8 @@ jobs:
5549
steps:
5650
- name: Checkout
5751
uses: actions/[email protected]
58-
- name: Setup Node.js
59-
uses: actions/[email protected]
60-
- uses: pnpm/[email protected]
61-
with:
62-
run_install: true
52+
- name: Setup
53+
uses: ./.github/actions/setup
6354

6455
- name: Build
6556
run: pnpm build
@@ -77,9 +68,8 @@ jobs:
7768
with:
7869
repository: fluent-vue/examples
7970
path: examples
80-
- name: Setup Node.js
81-
uses: actions/[email protected]
82-
- uses: pnpm/[email protected]
71+
- name: Setup
72+
uses: ./.github/actions/setup
8373

8474
- name: Test
8575
run: node scripts/build-examples.js

.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: 4 additions & 3 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": "*",
@@ -120,7 +120,6 @@
120120
"@vitejs/plugin-vue": "5.2.4",
121121
"@vitest/coverage-istanbul": "^3.1.4",
122122
"@vue/compiler-sfc": "3.5.16",
123-
"dotenv-cli": "8.0.0",
124123
"eslint": "9.28.0",
125124
"execa": "9.6.0",
126125
"husky": "9.1.7",
@@ -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)