Skip to content

Commit 245aa3e

Browse files
feat: switch to semantic-release for npm publishing
- Remove old manual npm publish workflow - Add semantic-release, @semantic-release/changelog, and @semantic-release/git as dev dependencies - Configure semantic-release in .releaserc.json to publish to npm and commit CHANGELOG.md back to repo - Add new semantic-release.yml GitHub Action triggered on main branch - Upgrade to Node 20 and v4 GitHub actions in workflow Co-authored-by: johndc7 <16856554+johndc7@users.noreply.github.com>
1 parent 1bace84 commit 245aa3e

File tree

5 files changed

+6387
-203
lines changed

5 files changed

+6387
-203
lines changed

.github/workflows/npm-publish.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
issues: write
14+
pull-requests: write
15+
id-token: write
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
persist-credentials: false
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 20
28+
registry-url: 'https://registry.npmjs.org/'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Semantic Release
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
37+
run: npx semantic-release

.releaserc.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"plugins": [
6+
"@semantic-release/commit-analyzer",
7+
"@semantic-release/release-notes-generator",
8+
"@semantic-release/changelog",
9+
"@semantic-release/npm",
10+
"@semantic-release/github",
11+
[
12+
"@semantic-release/git",
13+
{
14+
"assets": [
15+
"CHANGELOG.md",
16+
"package.json",
17+
"package-lock.json"
18+
],
19+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
20+
}
21+
]
22+
]
23+
}

0 commit comments

Comments
 (0)