-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path.releaserc.cjs
More file actions
233 lines (207 loc) · 8.59 KB
/
.releaserc.cjs
File metadata and controls
233 lines (207 loc) · 8.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/* eslint-disable no-template-curly-in-string */
// =============================================================================
// Semantic Release Configuration
// =============================================================================
//
// Automated version management and package publishing.
// Documentation: https://semantic-release.gitbook.io/
//
// -----------------------------------------------------------------------------
// How It Works
// -----------------------------------------------------------------------------
//
// Semantic Release automates the release process:
//
// 1. Analyze commits since last release
// 2. Determine version bump (major/minor/patch)
// 3. Generate changelog
// 4. Update version files
// 5. Create Git tag
// 6. Publish to registries
// 7. Create GitHub release
//
// Version bumps follow Semantic Versioning (semver.org):
// - BREAKING CHANGE → major (1.0.0 → 2.0.0)
// - feat: → minor (1.0.0 → 1.1.0)
// - fix: → patch (1.0.0 → 1.0.1)
//
// -----------------------------------------------------------------------------
// Usage
// -----------------------------------------------------------------------------
//
// Dry run (preview):
// npx semantic-release --dry-run
//
// Actual release (usually CI-only):
// npx semantic-release
//
// -----------------------------------------------------------------------------
// Required Environment Variables
// -----------------------------------------------------------------------------
//
// GITHUB_TOKEN: GitHub personal access token
// NPM_TOKEN: npm authentication token (if publishing to npm)
// PYPI_TOKEN: PyPI token (if publishing to PyPI)
//
// =============================================================================
module.exports = {
// JSON Schema for IDE support
$schema: "https://json.schemastore.org/semantic-release",
// ===========================================================================
// Release Branches
// ===========================================================================
//
// Branches that trigger releases:
// - main: Production releases (1.0.0, 1.1.0, etc.)
// - dev: Beta prereleases (1.1.0-beta.1)
// - next: Next prereleases (1.1.0-next.1)
//
// ---------------------------------------------------------------------------
branches: [
"main",
{
name: "dev",
prerelease: "beta", // 1.0.0-beta.1
},
{
name: "next",
prerelease: true, // 1.0.0-next.1
},
],
// ===========================================================================
// Tag Format
// ===========================================================================
//
// Git tag naming convention.
// v${version} creates tags like v1.0.0, v1.1.0-beta.1
//
// ---------------------------------------------------------------------------
tagFormat: "v${version}",
// ===========================================================================
// Plugins
// ===========================================================================
//
// Plugins run in order. Each plugin handles part of the release process.
//
// ---------------------------------------------------------------------------
plugins: [
// -------------------------------------------------------------------------
// Commit Analyzer
// -------------------------------------------------------------------------
// Analyzes commits to determine version bump type.
[
"@semantic-release/commit-analyzer",
{
// Use Conventional Commits format
preset: "conventionalcommits",
// Custom release rules
releaseRules: [
{ type: "feat", release: "minor" }, // Features → minor
{ type: "fix", release: "patch" }, // Fixes → patch
{ type: "perf", release: "patch" }, // Performance → patch
{ type: "revert", release: "patch" }, // Reverts → patch
{ type: "refactor", release: "patch" }, // Refactors → patch
// No release for these types
{ type: "docs", release: false },
{ type: "style", release: false },
{ type: "test", release: false },
{ type: "build", release: false },
{ type: "ci", release: false },
{ type: "chore", release: false },
// Breaking changes always trigger major
{ breaking: true, release: "major" },
],
},
],
// -------------------------------------------------------------------------
// Release Notes Generator
// -------------------------------------------------------------------------
// Generates changelog content from commits.
[
"@semantic-release/release-notes-generator",
{
preset: "conventionalcommits",
// Organize changelog by commit type
presetConfig: {
types: [
{ type: "feat", section: "✨ Features" },
{ type: "fix", section: "🐛 Bug Fixes" },
{ type: "perf", section: "⚡ Performance" },
{ type: "revert", section: "⏪ Reverts" },
{ type: "docs", section: "📚 Documentation" },
{ type: "refactor", section: "♻️ Refactoring" },
// Hidden sections (not in changelog)
{
type: "style",
section: "💎 Code Style",
hidden: true,
},
{ type: "test", section: "✅ Tests", hidden: true },
{ type: "build", section: "📦 Build", hidden: true },
{ type: "ci", section: "👷 CI/CD", hidden: true },
{ type: "chore", section: "🔧 Chores", hidden: true },
],
},
},
],
// -------------------------------------------------------------------------
// Changelog
// -------------------------------------------------------------------------
// Updates CHANGELOG.md file.
[
"@semantic-release/changelog",
{
changelogFile: "CHANGELOG.md",
changelogTitle: `# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).`,
},
],
// -------------------------------------------------------------------------
// Exec
// -------------------------------------------------------------------------
// Run custom commands during release.
// Updates VERSION file and syncs metadata across files.
[
"@semantic-release/exec",
{
prepareCmd:
"echo ${nextRelease.version} > VERSION && python bin/sync_metadata.py",
},
],
// -------------------------------------------------------------------------
// Git
// -------------------------------------------------------------------------
// Commits release changes and creates tag.
[
"@semantic-release/git",
{
// Files to commit
assets: [
"CHANGELOG.md",
"VERSION",
"pyproject.toml",
"package.json",
"codemeta.json",
"CITATION.cff",
],
// Commit message template
message:
"chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
},
],
// -------------------------------------------------------------------------
// GitHub
// -------------------------------------------------------------------------
// Creates GitHub release.
[
"@semantic-release/github",
{
// Don't comment on issues/PRs
successComment: false,
failComment: false,
},
],
],
};