Skip to content

Commit ad45898

Browse files
committed
chore: add contributor credits to release notes
1 parent 9c210cd commit ad45898

2 files changed

Lines changed: 72 additions & 54 deletions

File tree

.releaserc.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// .releaserc.js
2+
// Commits from external contributors (anyone not 'hamidi-dev') get a
3+
// "thanks @author" suffix automatically in the release notes.
4+
const MAINTAINER_NAMES = ['mohamed hamidi', 'hamidi-dev']
5+
6+
module.exports = {
7+
branches: ['main'],
8+
plugins: [
9+
[
10+
'@semantic-release/commit-analyzer',
11+
{
12+
preset: 'conventionalcommits',
13+
releaseRules: [
14+
{ type: 'feat', release: 'minor' },
15+
{ type: 'fix', release: 'patch' },
16+
{ type: 'perf', release: 'patch' },
17+
{ type: 'revert', release: 'patch' },
18+
{ type: 'docs', release: false },
19+
{ type: 'chore', release: false },
20+
{ type: 'refactor', release: 'patch' },
21+
{ type: 'test', release: false },
22+
{ breaking: true, release: 'major' },
23+
],
24+
},
25+
],
26+
[
27+
'@semantic-release/release-notes-generator',
28+
{
29+
preset: 'conventionalcommits',
30+
presetConfig: {
31+
types: [
32+
{ type: 'feat', section: 'Features' },
33+
{ type: 'fix', section: 'Bug Fixes' },
34+
{ type: 'perf', section: 'Performance' },
35+
{ type: 'refactor', section: 'Code Refactoring' },
36+
{ type: 'docs', section: 'Documentation', hidden: false },
37+
{ type: 'chore', hidden: true },
38+
{ type: 'test', hidden: true },
39+
],
40+
},
41+
writerOpts: {
42+
transform: (commit, context) => {
43+
if (!commit.type) return commit
44+
45+
const login = commit.authorName || ''
46+
// Append contributor credit for anyone who isn't the maintainer
47+
if (login && !MAINTAINER_NAMES.includes(login.toLowerCase())) {
48+
commit.subject = `${commit.subject} — thanks @${login}`
49+
}
50+
51+
return commit
52+
},
53+
},
54+
},
55+
],
56+
[
57+
'@semantic-release/changelog',
58+
{
59+
changelogFile: 'CHANGELOG.md',
60+
changelogTitle: '# Changelog\n\nAll notable changes to this project will be documented in this file.',
61+
},
62+
],
63+
[
64+
'@semantic-release/git',
65+
{
66+
assets: ['CHANGELOG.md'],
67+
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
68+
},
69+
],
70+
'@semantic-release/github',
71+
],
72+
}

.releaserc.json

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)