fix(release): changes to the changelog portion so its no longer a link

This commit is contained in:
2025-07-12 16:56:08 -05:00
parent 3d803dffdb
commit 1980a184e4

View File

@@ -9,6 +9,7 @@ import path from "path";
import { spawnSync } from "child_process"; import { spawnSync } from "child_process";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import fetch from "node-fetch"; import fetch from "node-fetch";
import conventionalChangelog from "conventional-changelog";
import dotenv from "dotenv"; import dotenv from "dotenv";
dotenv.config({ path: "./.env" }); dotenv.config({ path: "./.env" });
@@ -60,12 +61,20 @@ if (result.status !== 0) {
process.exit(1); process.exit(1);
} }
// Step 2: Read changelog content for current version const getLatestChangelog = async () => {
const changelog = await fs.readFile("CHANGELOG.md", "utf8"); const changelogStream = conventionalChangelog({
const regex = new RegExp(`## \\[${version}\\][\\s\\S]*?(?=## \\[|$)`, "m"); preset: "conventionalcommits",
const releaseNotes = changelog.match(regex)?.[0] || changelog; releaseCount: 1,
});
console.log(`Release notes for v${version} saved.`); let changelog = "";
for await (const chunk of changelogStream) {
changelog += chunk;
}
return changelog;
};
const releaseNotes = await getLatestChangelog();
// Step 3: Create or update Gitea release // Step 3: Create or update Gitea release
const createOrUpdateRelease = async () => { const createOrUpdateRelease = async () => {