From 29d8af3c382760ce747a937ab90bf4d92b161d4f Mon Sep 17 00:00:00 2001 From: fadeltd Date: Wed, 18 Nov 2026 12:34:30 +0700 Subject: [PATCH] Show the site version in the header; clean release notes The header shows the site's version between its name and the local-only badge, linking to that version's GitHub release. The release notes script now writes its own output file instead of being redirected from stdout, where pnpm printed its dependency check first and put it at the top of every site release. Site releases now open with a link to https://devtools.fadeltd.dev. --- .github/workflows/release.yml | 8 +++++--- CHANGELOG.md | 3 ++- scripts/release-notes.ts | 20 ++++++++++++-------- src/app/RootLayout.tsx | 13 +++++++++++++ src/env.d.ts | 4 ++++ vite.config.ts | 8 ++++++++ 6 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 src/env.d.ts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 29f5232..74b68c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -164,8 +164,8 @@ jobs: fi case "$TAG" in - core-v*) FILE=packages/core/CHANGELOG.md; TITLE="@fadeltd/devtools-core ${TAG#core-v}" ;; - *) FILE=CHANGELOG.md; TITLE="$TAG" ;; + core-v*) FILE=packages/core/CHANGELOG.md; TITLE="@fadeltd/devtools-core ${TAG#core-v}"; SITE=() ;; + *) FILE=CHANGELOG.md; TITLE="$TAG"; SITE=(https://devtools.fadeltd.dev) ;; esac if ! gh release view "$TAG" > /dev/null 2>&1; then # Notes come from the changelog as it was at that release @@ -173,7 +173,9 @@ jobs: # expressions are pasted into the script before bash parses # it, so a backtick in the notes would run as a command. git show "${SHA}:${FILE}" > "$RUNNER_TEMP/changelog.md" - pnpm exec vite-node scripts/release-notes.ts "$RUNNER_TEMP/changelog.md" "${TAG#*v}" > "$RUNNER_TEMP/notes.md" + # The notes are written to a file by the script itself, not + # redirected from stdout: pnpm prints its dependency check there. + pnpm exec vite-node scripts/release-notes.ts "$RUNNER_TEMP/changelog.md" "${TAG#*v}" "$RUNNER_TEMP/notes.md" "${SITE[@]}" gh release create "$TAG" --verify-tag --title "$TITLE" --notes-file "$RUNNER_TEMP/notes.md" fi case "$TAG" in v*) DEPLOY_TAG=$TAG ;; esac diff --git a/CHANGELOG.md b/CHANGELOG.md index a26d441..9cbde78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and ## [Unreleased] -Nothing yet. +### Added +- The header shows the site's version next to its name, linking to that version's release notes, so it is easy to tell whether a reload is still needed to pick up a new release. ## [0.17.0] — 2026-11-16 diff --git a/scripts/release-notes.ts b/scripts/release-notes.ts index 132d63f..eb437d4 100644 --- a/scripts/release-notes.ts +++ b/scripts/release-notes.ts @@ -1,17 +1,21 @@ /** - * Print the notes of one released version from a changelog file, for creating + * Write the notes of one released version from a changelog file, for creating * a GitHub release after the fact. Release reads the changelog as it stood at * that release commit (`git show :CHANGELOG.md`), so later edits never - * leak into an older release. + * leak into an older release. A site URL, when given, opens the notes. * - * pnpm exec vite-node scripts/release-notes.ts CHANGELOG.md 0.8.0 + * pnpm exec vite-node scripts/release-notes.ts CHANGELOG.md 0.8.0 notes.md https://devtools.fadeltd.dev + * + * The notes go to a file, never stdout: `pnpm exec` can print its own + * dependency check to stdout first, and that once ended up at the top of + * every site release. */ -import { readFileSync } from 'node:fs' +import { readFileSync, writeFileSync } from 'node:fs' import { releaseNotes } from './changelog' -const [file, version] = process.argv.slice(2) -if (file === undefined || version === undefined) { - console.error('usage: release-notes.ts ') +const [file, version, out, siteUrl] = process.argv.slice(2) +if (file === undefined || version === undefined || out === undefined) { + console.error('usage: release-notes.ts [site-url]') process.exit(2) } @@ -20,4 +24,4 @@ if (notes === null) { console.error(`No [${version}] section in ${file}`) process.exit(1) } -console.log(notes) +writeFileSync(out, `${siteUrl === undefined ? '' : `Live at ${siteUrl}\n\n`}${notes}\n`) diff --git a/src/app/RootLayout.tsx b/src/app/RootLayout.tsx index c85f490..c4a53ca 100644 --- a/src/app/RootLayout.tsx +++ b/src/app/RootLayout.tsx @@ -94,6 +94,19 @@ export default function RootLayout() { + {/* Says which build is on screen, which is the first question when + something new is missing: the service worker keeps serving the + previous version until the next reload after a deploy. */} + + v{import.meta.env.APP_VERSION} + + {/* States the product thesis where it is always visible. It is also literally true: there is no backend to send anything to. */}