Skip to content

Commit cf6fcac

Browse files
committed
feat: add @semantic-release/commit-analyzer plugin and update release workflow
1 parent f801a3a commit cf6fcac

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,36 @@ jobs:
3232
- name: Build
3333
run: npm run build
3434

35-
- name: Save original package.json
36-
run: cp package.json package.json.bak
35+
- name: Configure Git identity
36+
run: |
37+
git config --global user.name 'github-actions[bot]'
38+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
3739
3840
- name: Release
3941
env:
4042
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4143
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4244
run: npx semantic-release
4345

44-
- name: Restore original package.json
45-
if: always()
46+
- name: Commit version update
4647
run: |
47-
mv package.json.bak package.json || echo "No backup file to restore"
4848
git add package.json
49-
git commit -m "fix: restore original package.json [skip ci]" || echo "No changes to commit"
50-
git push origin main
49+
git commit -m "chore: update package.json version [skip ci]" || echo "No version changes to commit"
50+
git push origin main || echo "No changes to push"
51+
52+
- name: Stash prepack changes
53+
run: |
54+
git stash push -m "Stashing prepack changes" || echo "No prepack changes to stash"
5155
5256
- name: Sync dev branch with main
53-
if: success()
5457
run: |
5558
git fetch origin dev:dev || git checkout -b dev
5659
git checkout dev
5760
git pull origin dev || true
5861
git merge main --ff-only || (git merge main && git push origin dev)
59-
git push origin dev
62+
git push origin dev
63+
64+
- name: Clean up stash
65+
if: always()
66+
run: |
67+
git stash drop || echo "No stash to drop"

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
},
3030
"devDependencies": {
3131
"@semantic-release/changelog": "^6.0.3",
32+
"@semantic-release/commit-analyzer": "^13.0.1",
3233
"@semantic-release/git": "^10.0.1",
3334
"@semantic-release/npm": "^12.0.1",
3435
"@types/node": "^20.9.0",
@@ -63,5 +64,25 @@
6364
"build:it": "npx pkgroll --clean-dist --minify --env.DEBUG_LOG=false --env.MENU_LANGUAGE=it",
6465
"pack:test": "npm pack --dry-run",
6566
"prepack": "clean-pkg-json -r dependencies"
66-
}
67+
},
68+
"plugins": [
69+
"@semantic-release/commit-analyzer",
70+
"@semantic-release/release-notes-generator",
71+
[
72+
"@semantic-release/npm",
73+
{
74+
"updatePackageJson": true,
75+
"npmPublish": true
76+
}
77+
],
78+
[
79+
"@semantic-release/git",
80+
{
81+
"assets": [
82+
"package.json"
83+
],
84+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
85+
}
86+
]
87+
]
6788
}

0 commit comments

Comments
 (0)