mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 08:21:39 -06:00
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:
@@ -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
@@ -42,7 +42,7 @@ const commitPartial = `\
|
||||
{{~#if this.owner}}
|
||||
{{~this.owner}}/
|
||||
{{~/if}}
|
||||
{{~this.repository}}{{this.prefix}}{{this.issue}}]({{issueUrlFormat}})
|
||||
{{~this.repository}}{{this.prefix}}{{this.issue}}]({{@root.host}}/{{@root.owner}}/{{@root.repository}}/issues/{{this.issue}})
|
||||
{{~else}}
|
||||
{{~#if this.owner}}
|
||||
{{~this.owner}}/
|
||||
@@ -94,7 +94,7 @@ const mainTemplate = [
|
||||
// for the commitPartial.
|
||||
function finalizeContext(ctx) {
|
||||
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",
|
||||
cwd: process.cwd(),
|
||||
});
|
||||
@@ -103,17 +103,17 @@ function finalizeContext(ctx) {
|
||||
if (result.status === 0) {
|
||||
for (const line of result.stdout.split("\n").filter(Boolean)) {
|
||||
const spaceIdx = line.indexOf(" ");
|
||||
const shortSha = line.substring(0, spaceIdx);
|
||||
const hash = line.substring(0, spaceIdx);
|
||||
const authorName = line.substring(spaceIdx + 1).trim();
|
||||
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 commit of group.commits ?? []) {
|
||||
if (commit.shortHash) {
|
||||
const githubUser = shaToGithubUser.get(commit.shortHash);
|
||||
if (commit.hash) {
|
||||
const githubUser = shaToGithubUser.get(commit.hash);
|
||||
if (githubUser) commit.githubUser = githubUser;
|
||||
}
|
||||
// Pre-compute commit URL — {{commitUrlFormat}} does not resolve inside
|
||||
|
||||
Reference in New Issue
Block a user