Skip to content

Commit 31a3e05

Browse files
committed
fix: migrate to semantic-release and fix date-fns v4 ESM compatibility
- Replace manual npm-publish workflow with semantic-release - Downgrade date-fns from v4.x to v3.x for CommonJS compatibility - Add semantic-release dependencies - Automatic versioning based on commit messages (fix: → patch, feat: → minor) - Automatic CHANGELOG generation - NPM provenance support
1 parent d3715ff commit 31a3e05

File tree

4 files changed

+73
-66
lines changed

4 files changed

+73
-66
lines changed

.github/workflows/npm-publish.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
# OIDC Trusted Publishing - No npm tokens needed!
9+
# npm trusts GitHub Actions directly via OIDC
10+
# See: https://docs.npmjs.com/generating-provenance-statements
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
issues: write
18+
pull-requests: write
19+
id-token: write # Required for OIDC trusted publishing
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
persist-credentials: false
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '22'
32+
registry-url: 'https://registry.npmjs.org'
33+
34+
- name: Install dependencies
35+
run: npm install
36+
37+
- name: Build plugin
38+
run: npm run build
39+
40+
- name: Verify plugin
41+
run: npm run verify
42+
43+
- name: Release
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
48+
NPM_CONFIG_PROVENANCE: true
49+
run: npx semantic-release

.releaserc.json

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

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@
4747
"zod": "^3.24.1"
4848
},
4949
"devDependencies": {
50+
"@semantic-release/changelog": "^6.0.3",
51+
"@semantic-release/commit-analyzer": "^13.0.0",
52+
"@semantic-release/git": "^10.0.1",
53+
"@semantic-release/github": "^11.0.2",
54+
"@semantic-release/npm": "^12.0.1",
55+
"@semantic-release/release-notes-generator": "^14.0.1",
5056
"@strapi/design-system": "^2.0.2",
5157
"@strapi/icons": "^2.0.2",
5258
"@strapi/sdk-plugin": "^5.3.2",
@@ -57,6 +63,7 @@
5763
"react": "^18.3.1",
5864
"react-dom": "^18.3.1",
5965
"react-router-dom": "^6.30.2",
66+
"semantic-release": "^24.2.3",
6067
"styled-components": "^6.1.19"
6168
},
6269
"peerDependencies": {

0 commit comments

Comments
 (0)