build: remove legacy release config and fix hash-based attribution

Use a single semantic-release config to avoid diverging behavior, and update the release notes context logic to map authors with full commit hashes and stable issue URLs.
This commit is contained in:
neon
2026-05-23 01:49:45 +00:00
parent 3e837c4fb9
commit f651039535
2 changed files with 6 additions and 56 deletions
-50
View File
@@ -1,50 +0,0 @@
// @ts-check
/** @type {import('semantic-release').GlobalConfig} */
module.exports = {
branches: ["main"],
tagFormat: "v${version}",
repositoryUrl: "https://github.com/bookorbit/bookorbit",
plugins: [
[
"@semantic-release/commit-analyzer",
{
preset: "conventionalcommits",
releaseRules: [
{ type: "feat", release: "minor" },
{ type: "fix", release: "patch" },
{ type: "security", release: "patch" },
{ type: "perf", release: "patch" },
{ type: "db", release: "patch" },
{ type: "revert", release: "patch" },
{ breaking: true, release: "major" },
],
},
],
[
"@semantic-release/release-notes-generator",
{
preset: "conventionalcommits",
linkReferences: true,
presetConfig: {
types: [
{ type: "feat", section: "Features" },
{ type: "fix", section: "Bug Fixes" },
{ type: "security", section: "Security" },
{ type: "perf", section: "Performance" },
{ type: "db", section: "Database" },
{ type: "revert", section: "Reverts" },
{ type: "docs", hidden: true },
{ type: "chore", hidden: true },
{ type: "refactor", hidden: true },
{ type: "style", hidden: true },
{ type: "test", hidden: true },
{ type: "build", hidden: true },
{ type: "ci", hidden: true },
],
},
},
],
"@semantic-release/github",
],
};
+6 -6
View File
@@ -42,7 +42,7 @@ const commitPartial = `\
{{~#if this.owner}} {{~#if this.owner}}
{{~this.owner}}/ {{~this.owner}}/
{{~/if}} {{~/if}}
{{~this.repository}}{{this.prefix}}{{this.issue}}]({{issueUrlFormat}}) {{~this.repository}}{{this.prefix}}{{this.issue}}]({{@root.host}}/{{@root.owner}}/{{@root.repository}}/issues/{{this.issue}})
{{~else}} {{~else}}
{{~#if this.owner}} {{~#if this.owner}}
{{~this.owner}}/ {{~this.owner}}/
@@ -94,7 +94,7 @@ const mainTemplate = [
// for the commitPartial. // for the commitPartial.
function finalizeContext(ctx) { function finalizeContext(ctx) {
try { try {
const result = spawnSync("git", ["log", "--format=%h %aN", "--max-count=500"], { const result = spawnSync("git", ["log", "--format=%H %aN", "--max-count=500"], {
encoding: "utf8", encoding: "utf8",
cwd: process.cwd(), cwd: process.cwd(),
}); });
@@ -103,17 +103,17 @@ function finalizeContext(ctx) {
if (result.status === 0) { if (result.status === 0) {
for (const line of result.stdout.split("\n").filter(Boolean)) { for (const line of result.stdout.split("\n").filter(Boolean)) {
const spaceIdx = line.indexOf(" "); const spaceIdx = line.indexOf(" ");
const shortSha = line.substring(0, spaceIdx); const hash = line.substring(0, spaceIdx);
const authorName = line.substring(spaceIdx + 1).trim(); const authorName = line.substring(spaceIdx + 1).trim();
if (!authorName || /\[bot\]/i.test(authorName)) continue; if (!authorName || /\[bot\]/i.test(authorName)) continue;
shaToGithubUser.set(shortSha, AUTHOR_MAP[authorName] ?? authorName); shaToGithubUser.set(hash, AUTHOR_MAP[authorName] ?? authorName);
} }
} }
for (const group of ctx.commitGroups ?? []) { for (const group of ctx.commitGroups ?? []) {
for (const commit of group.commits ?? []) { for (const commit of group.commits ?? []) {
if (commit.shortHash) { if (commit.hash) {
const githubUser = shaToGithubUser.get(commit.shortHash); const githubUser = shaToGithubUser.get(commit.hash);
if (githubUser) commit.githubUser = githubUser; if (githubUser) commit.githubUser = githubUser;
} }
// Pre-compute commit URL — {{commitUrlFormat}} does not resolve inside // Pre-compute commit URL — {{commitUrlFormat}} does not resolve inside