Skip to content

Commit 00b0ac3

Browse files
authored
ci: automatically create release PR and publish to NPM (#13)
1 parent 28245e9 commit 00b0ac3

3 files changed

Lines changed: 51 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,39 @@ permissions:
1111
jobs:
1212
release:
1313
runs-on: ubuntu-latest
14+
outputs:
15+
release_created: ${{ steps.release.outputs.release_created }}
16+
tag_name: ${{ steps.release.outputs.tag_name }}
1417
steps:
1518
- uses: googleapis/release-please-action@v4
19+
id: release
1620
with:
17-
release-type: node
21+
config-file: release-please-config.json
22+
manifest-file: .release-please-manifest.json
23+
24+
publish:
25+
needs: release
26+
if: ${{ needs.release.outputs.release_created == 'true' }}
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Setup Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: "20"
36+
registry-url: "https://registry.npmjs.org"
37+
cache: "npm"
38+
39+
- name: Install dependencies
40+
run: npm ci
41+
42+
- name: Build
43+
run: npm run build
44+
45+
- name: Publish to npm
46+
run: npm publish --access public
47+
env:
48+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1849

.release-please-manifest.json

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

release-please-config.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"release-type": "node",
4+
"packages": {
5+
".": {
6+
"changelog-path": "CHANGELOG.md",
7+
"release-type": "node",
8+
"bump-minor-pre-major": true,
9+
"bump-patch-for-minor-pre-major": true
10+
}
11+
},
12+
"include-component-in-tag": false,
13+
"include-v-in-tag": true
14+
}
15+

0 commit comments

Comments
 (0)