Skip to content

Commit 3d4f310

Browse files
authored
ci(release): automate release PRs and npm publishing (#35)
* ci(release): automate release PRs and npm publishing * fix(audit): patch high severity dependency vulnerabilities
1 parent 5718f0f commit 3d4f310

File tree

5 files changed

+121
-31
lines changed

5 files changed

+121
-31
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
issues: write
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: false
17+
18+
jobs:
19+
release-please:
20+
name: Prepare Release
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 15
23+
outputs:
24+
release_created: ${{ steps.release.outputs.release_created }}
25+
tag_name: ${{ steps.release.outputs.tag_name }}
26+
27+
steps:
28+
- name: Run release-please
29+
id: release
30+
uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
31+
with:
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
config-file: release-please-config.json
34+
manifest-file: .release-please-manifest.json
35+
36+
publish-npm:
37+
name: Publish to npm
38+
needs: release-please
39+
if: ${{ needs.release-please.outputs.release_created == 'true' }}
40+
runs-on: ubuntu-latest
41+
timeout-minutes: 20
42+
permissions:
43+
contents: read
44+
id-token: write
45+
46+
steps:
47+
- name: Checkout release tag
48+
uses: actions/checkout@v4
49+
with:
50+
ref: ${{ needs.release-please.outputs.tag_name }}
51+
52+
- name: Setup pnpm
53+
uses: pnpm/action-setup@v4
54+
with:
55+
run_install: false
56+
57+
- name: Setup Node
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: 22
61+
registry-url: https://registry.npmjs.org
62+
cache: pnpm
63+
64+
- name: Install dependencies
65+
run: pnpm install --frozen-lockfile
66+
67+
- name: Publish package
68+
run: pnpm publish --access public --no-git-checks --provenance
69+
env:
70+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.5.10"
3+
}

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"fast-glob": "^3.3.2",
100100
"log-update": "^7.0.2",
101101
"picocolors": "^1.1.1",
102-
"picomatch": "^4.0.3",
102+
"picomatch": "^4.0.4",
103103
"zod": "^4.3.6"
104104
},
105105
"devDependencies": {
@@ -138,7 +138,10 @@
138138
},
139139
"pnpm": {
140140
"overrides": {
141-
"minimatch@>=10.0.0 <10.2.3": "10.2.4"
141+
"defu@<=6.1.4": "6.1.5",
142+
"lodash@>=4.0.0 <=4.17.23": "4.18.0",
143+
"minimatch@>=10.0.0 <10.2.3": "10.2.4",
144+
"picomatch@<2.3.2": "2.3.2"
142145
}
143146
}
144147
}

pnpm-lock.yaml

Lines changed: 33 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release-please-config.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"packages": {
4+
".": {
5+
"release-type": "node",
6+
"include-component-in-tag": false,
7+
"include-v-in-tag": true
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)