Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,18 @@ 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
# commit, and go through a file, never an Actions expression:
# 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
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 12 additions & 8 deletions scripts/release-notes.ts
Original file line number Diff line number Diff line change
@@ -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 <sha>: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 <changelog> <version>')
const [file, version, out, siteUrl] = process.argv.slice(2)
if (file === undefined || version === undefined || out === undefined) {
console.error('usage: release-notes.ts <changelog> <version> <out-file> [site-url]')
process.exit(2)
}

Expand All @@ -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`)
13 changes: 13 additions & 0 deletions src/app/RootLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ export default function RootLayout() {
</span>
</Link>

{/* 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. */}
<a
href={`https://github.com/fadeltd/devtools/releases/tag/v${import.meta.env.APP_VERSION}`}
target="_blank"
rel="noreferrer noopener"
title={`Release notes for v${import.meta.env.APP_VERSION}`}
className="hidden min-h-11 items-center rounded-[4px] px-1 font-mono text-[11px] text-faint hover:text-fg sm:inline-flex md:min-h-0"
>
v{import.meta.env.APP_VERSION}
</a>

{/* States the product thesis where it is always visible. It is also
literally true: there is no backend to send anything to. */}
<span
Expand Down
4 changes: 4 additions & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface ImportMetaEnv {
/** The site's `package.json` version, inlined by `define` in `vite.config.ts`. */
readonly APP_VERSION: string
}
8 changes: 8 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import { defineConfig } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'

// Release bumps this on the release commit, which is the commit Deploy builds,
// so the deployed site's version always names a real tag.
const { version } = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')) as {
version: string
}

export default defineConfig({
define: { 'import.meta.env.APP_VERSION': JSON.stringify(version) },
plugins: [
react(),
tailwindcss(),
Expand Down
Loading