An open source, self-hosted, real-time port monitoring and discovery tool.
chore: generate release notes from CHANGELOG using What's New parser
Mostafa-Wahied27d0d5528776
diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.ymlindex 0aabdb9..64e9992 100644--- a/.github/workflows/auto-tag.yml+++ b/.github/workflows/auto-tag.yml@@ -72,22 +72,25 @@ jobs:echo "Created and pushed tag: $TAG"+ - name: Generate release notes+ if: steps.version-check.outputs.changed == 'true'+ id: release-notes+ run: |+ node scripts/generate-release-notes.mjs \+ "${{ steps.current-version.outputs.version }}" \+ "${{ steps.previous-version.outputs.previous }}" \+ > release-notes.md+ echo "Generated release notes:"+ cat release-notes.md+- name: Create GitHub Releaseif: steps.version-check.outputs.changed == 'true'- uses: actions/create-release@v1+ uses: softprops/action-gh-release@v2env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}with:tag_name: ${{ steps.version-check.outputs.tag }}- release_name: Release ${{ steps.current-version.outputs.version }}- body: |- ## What's Changed-- Automatic release for version ${{ steps.current-version.outputs.version }}-- ### Changes- - See commit history for detailed changes-- **Full Changelog**: https://github.com/${{ github.repository }}/compare/v${{ steps.previous-version.outputs.previous }}...${{ steps.version-check.outputs.tag }}+ name: Release ${{ steps.current-version.outputs.version }}+ body_path: release-notes.mddraft: falseprerelease: falsediff --git a/frontend/src/lib/whats-new-config.js b/frontend/src/lib/whats-new-config.jsindex 1a4049a..6f3c72d 100644--- a/frontend/src/lib/whats-new-config.js+++ b/frontend/src/lib/whats-new-config.js@@ -25,11 +25,45 @@ const whatsNewConfig = {'Data Collection','Docker Integration','Web Interface',- 'Server Management',- 'Server Health Indicator',- 'Last Refreshed Timestamp'+ 'Server Management'],featureOverrides: {+ 'Sidebar Reordering': {+ title: 'Drag-and-drop sidebar order',+ description: 'Reorder servers by dragging; the order persists across reloads and prioritizes autoxpose suggestions based on your custom order.'+ },+ 'Sidebar Sort Modes': {+ title: 'Custom and alphabetical sort modes',+ description: 'A sidebar chip cycles through Custom, A→Z, and Z→A. Alphabetical modes are view-only, with an undo banner to revert.'+ },+ 'Sidebar Controls': {+ title: 'Resizable, collapsible sidebar',+ description: 'Resize the desktop sidebar or collapse it to an icon rail; a one-time coachmark points out the new controls.'+ },+ 'Keyboard Shortcuts': {+ title: 'Keyboard shortcuts',+ description: 'Cmd/Ctrl+K focuses search, Esc clears, Cmd/Ctrl+B toggles the sidebar, Cmd/Ctrl+R refreshes, and 1–9 quick-switch between servers.'+ },+ 'Server Health Indicator': {+ title: 'Server health at a glance',+ description: 'Sidebar server cards show a colored dot — green for online, red for unreachable, a blue pulse while updating.'+ },+ 'Last Refreshed Timestamp': {+ title: '"Updated Xm ago" on every server',+ description: 'Each server card shows a live-updating timestamp of when its data was last fetched.'+ },+ 'Status Wording': {+ title: 'Clearer port status wording',+ description: 'Updated copy on per-port indicators and the rolled-up status dot so an unreachable published port reads clearly.'+ },+ 'Status Dot Loading State': {+ title: 'Smoother loading state',+ description: 'Service cards show a soft pulsing dot while health data is loading instead of briefly flashing red.'+ },+ 'Service Card Grouping': {+ title: 'Consolidated multi-port services',+ description: 'Containers publishing multiple ports now group into a single service card instead of splitting on inconsistent compose labels.'+ },'Container Heuristic': {title: 'Better service naming in stack deployments',description: 'Reduced false matches when containers share the same stack name.'diff --git a/scripts/generate-release-notes.mjs b/scripts/generate-release-notes.mjsnew file mode 100644index 0000000..4cd61e4--- /dev/null+++ b/scripts/generate-release-notes.mjs@@ -0,0 +1,153 @@+#!/usr/bin/env node+import { readFileSync } from "node:fs";+import { fileURLToPath, pathToFileURL } from "node:url";+import { dirname, resolve } from "node:path";++const __filename = fileURLToPath(import.meta.url);+const __dirname = dirname(__filename);+const repoRoot = resolve(__dirname, "..");++const version = process.argv[2];+const previousVersion = process.argv[3] || "";+const repository = process.env.GITHUB_REPOSITORY || "mostafa-wahied/portracker";++if (!version) {+ console.error("usage: generate-release-notes.mjs <version> [previous-version]");+ process.exit(1);+}++const configUrl = pathToFileURL(+ resolve(repoRoot, "frontend/src/lib/whats-new-config.js")+).href;+const { default: whatsNewConfig } = await import(configUrl);++const hiddenTitles = new Set(+ (whatsNewConfig.hiddenTitles || []).map((title) => title.toLowerCase())+);+const featureOverrides = whatsNewConfig.featureOverrides || {};++const changelog = readFileSync(resolve(repoRoot, "CHANGELOG.md"), "utf8");+const lines = changelog.split("\n");++const versionHeader = new RegExp(+ `^##\\s*\\[${version.replace(/\./g, "\\.")}\\]`+);+const anyVersionHeader = /^##\s*\[/;++let inSection = false;+let captured = [];+for (const line of lines) {+ if (versionHeader.test(line)) {+ inSection = true;+ continue;+ }+ if (inSection && anyVersionHeader.test(line)) break;+ if (inSection) captured.push(line);+}++if (captured.length === 0) {+ console.error(`No CHANGELOG section found for version ${version}`);+ process.exit(1);+}++function normalizeDescription(text) {+ return text+ .replace(/\s*\((?:resolves|addresses)?\s*#\d+\)/gi, "")+ .replace(/\s*\(#\d+(?:\s*,\s*PR\s*#\d+)?(?:\s+by\s+@[^)]+)?\)/gi, "")+ .replace(/`([^`]+)`/g, "$1")+ .trim();+}++const bulletPattern = /^\s*-\s*\*\*\[?([^*\]]+?)\]?\*\*:\s*(.+)$/;+const subBulletPattern = /^\s*-\s*\*\*\[sub\]\*\*\s+(.+)$/i;++const out = [];+let lastVisible = true;+let currentSection = null;+let sectionHasContent = false;++for (const raw of captured) {+ const line = raw.trimEnd();++ const sectionMatch = line.match(/^###\s+(.+)$/);+ if (sectionMatch) {+ if (currentSection && sectionHasContent) {+ out.push("");+ }+ currentSection = sectionMatch[1].trim();+ sectionHasContent = false;+ out.push(`### ${currentSection}`);+ out.push("");+ continue;+ }++ const subMatch = line.match(subBulletPattern);+ if (subMatch && lastVisible) {+ out.push(` - ${normalizeDescription(subMatch[1])}`);+ sectionHasContent = true;+ continue;+ }++ const match = line.match(bulletPattern);+ if (match) {+ const title = match[1].trim();+ const description = match[2].trim();+ if (hiddenTitles.has(title.toLowerCase())) {+ lastVisible = false;+ continue;+ }+ const override = featureOverrides[title];+ if (override?.hidden) {+ lastVisible = false;+ continue;+ }+ const finalTitle = override?.title || title;+ const finalDescription = override?.description || normalizeDescription(description);+ out.push(`- **${finalTitle}**: ${finalDescription}`);+ sectionHasContent = true;+ lastVisible = true;+ continue;+ }++ if (line.trim() === "") {+ lastVisible = true;+ }+}++while (out.length && out[out.length - 1].trim() === "") out.pop();++const filtered = [];+for (let i = 0; i < out.length; i++) {+ const line = out[i];+ if (/^###\s+/.test(line)) {+ let hasContent = false;+ for (let j = i + 1; j < out.length; j++) {+ if (/^###\s+/.test(out[j])) break;+ if (/^\s*-\s/.test(out[j])) {+ hasContent = true;+ break;+ }+ }+ if (!hasContent) {+ if (i + 1 < out.length && out[i + 1].trim() === "") i++;+ continue;+ }+ }+ filtered.push(line);+}+while (filtered.length && filtered[filtered.length - 1].trim() === "") filtered.pop();++const compareUrl = previousVersion+ ? `https://github.com/${repository}/compare/v${previousVersion}...v${version}`+ : `https://github.com/${repository}/releases`;++const body = [+ `## What's New in ${version}`,+ "",+ ...filtered,+ "",+ `**Full Changelog**: ${compareUrl}`,+ "",+].join("\n");++process.stdout.write(body);