fix: sticky header regression (#5869)
* fix: sticky header regression * fix: github release changelog format for app release workflow * fix: lint
This commit is contained in:
71
.github/workflows/theseus-release.yml
vendored
71
.github/workflows/theseus-release.yml
vendored
@@ -55,76 +55,7 @@ jobs:
|
||||
- name: 📝 Extract app changelog
|
||||
env:
|
||||
VERSION: ${{ env.VERSION_TAG }}
|
||||
run: |
|
||||
node <<'EOF'
|
||||
const fs = require('fs');
|
||||
const version = process.env.VERSION.replace(/^v/, '');
|
||||
const src = fs.readFileSync('packages/blog/changelog.ts', 'utf8');
|
||||
|
||||
// Parse every entry in the VERSIONS array, preserving their order
|
||||
// (which is reverse chronological).
|
||||
const entryRe = /\{\s*date:\s*`([^`]+)`,\s*product:\s*'(\w+)',(?:\s*version:\s*[`']([^`']+)[`'],)?\s*body:\s*`([\s\S]*?)`,\s*\}/g;
|
||||
const entries = [];
|
||||
let match;
|
||||
while ((match = entryRe.exec(src)) !== null) {
|
||||
entries.push({
|
||||
date: match[1],
|
||||
product: match[2],
|
||||
version: match[3],
|
||||
body: match[4],
|
||||
});
|
||||
}
|
||||
|
||||
const currentIdx = entries.findIndex(
|
||||
(e) => e.product === 'app' && e.version === version,
|
||||
);
|
||||
if (currentIdx === -1) {
|
||||
console.error(`No app changelog entry found for version ${version}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Find the surrounding app entries so we can scope hosting changes to
|
||||
// exactly what shipped between the previous app release and this one.
|
||||
// Entries are in reverse chronological order, so newer entries have
|
||||
// smaller indices than older entries.
|
||||
let newerAppIdx = -1;
|
||||
for (let i = currentIdx - 1; i >= 0; i--) {
|
||||
if (entries[i].product === 'app') {
|
||||
newerAppIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
let previousAppIdx = entries.length;
|
||||
for (let i = currentIdx + 1; i < entries.length; i++) {
|
||||
if (entries[i].product === 'app') {
|
||||
previousAppIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const hostingEntries = [];
|
||||
for (let i = newerAppIdx + 1; i < previousAppIdx; i++) {
|
||||
if (entries[i].product === 'hosting') {
|
||||
hostingEntries.push(entries[i]);
|
||||
}
|
||||
}
|
||||
|
||||
let output = entries[currentIdx].body;
|
||||
if (hostingEntries.length > 0) {
|
||||
// Demote any top-level section headings inside hosting bodies so
|
||||
// they nest cleanly under the "Modrinth Hosting (included)" header.
|
||||
const demoteHeadings = (body) =>
|
||||
body.replace(/^(#{1,5})\s/gm, (_, hashes) => `${hashes}# `);
|
||||
const hostingBody = hostingEntries
|
||||
.map((e) => demoteHeadings(e.body))
|
||||
.join('\n\n');
|
||||
output += `\n\n---\n\n## Modrinth Hosting (included)\n\n${hostingBody}`;
|
||||
}
|
||||
|
||||
fs.writeFileSync('release-notes.md', output);
|
||||
console.log(`Extracted changelog for app ${version}:`);
|
||||
console.log(output);
|
||||
EOF
|
||||
run: npx --yes tsx scripts/build-theseus-release-notes.ts
|
||||
|
||||
- name: 🛠️ Generate version manifest
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user