Skip to content

Commit 4ac3b1c

Browse files
committed
feat(footer): site version label; deploy Node 24; changeset
1 parent 86e0793 commit 4ac3b1c

5 files changed

Lines changed: 64 additions & 9 deletions

File tree

.changeset/footer-site-version.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'pendragon-coding': patch
3+
---
4+
5+
Show package version in site footer after Links for live deploy verification.

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup Node
1616
uses: actions/setup-node@v4
1717
with:
18-
node-version: '22.12'
18+
node-version: '24'
1919

2020
- name: Setup Bun
2121
uses: oven-sh/setup-bun@v2

docs/deployment-guide.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ flowchart TD
4343

4444
### deploy.yml
4545

46-
| Field | Value |
47-
| ----------- | --------------------------------------------------------------------------------------------------- |
48-
| **Trigger** | Git tags matching `v*` |
49-
| **Runner** | Ubuntu latest |
50-
| **Steps** | Checkout -> Setup Node 22.12+ -> Setup Bun -> `bun install` -> `bun run build` -> Deploy to Netlify |
51-
| **Action** | `nwtgck/actions-netlify@v3.0` |
52-
| **Secrets** | `NETLIFY_AUTH_TOKEN`, `NETLIFY_SITE_ID`, `GITHUB_TOKEN` |
46+
| Field | Value |
47+
| ----------- | ----------------------------------------------------------------------------------------------- |
48+
| **Trigger** | Git tags matching `v*` |
49+
| **Runner** | Ubuntu latest |
50+
| **Steps** | Checkout -> Setup Node 24 -> Setup Bun -> `bun install` -> `bun run build` -> Deploy to Netlify |
51+
| **Action** | `nwtgck/actions-netlify@v3.0` |
52+
| **Secrets** | `NETLIFY_AUTH_TOKEN`, `NETLIFY_SITE_ID`, `GITHUB_TOKEN` |
5353

5454
### release.yml
5555

@@ -95,7 +95,7 @@ If either check fails, the build aborts and the deploy does not proceed.
9595

9696
**Netlify logs** for this repo: Git builds are skipped by `ignore = "exit 0"`, so you will see “Canceled build due to no content change” / ignore exit 0 — that is **not** the same failure as the Actions log above. Production depends on `deploy.yml` succeeding after the tag push.
9797

98-
**Fix:** `deploy.yml` runs `actions/setup-node` with Node **22.12** before `bun install` / `bun run build` so `node` on `PATH` satisfies Astro’s CLI. Bun remains the package manager and script runner.
98+
**Fix:** `deploy.yml` runs `actions/setup-node` with Node **24** (matches Netlify UI; satisfies Astro’s `>=22.12`) before `bun install` / `bun run build` so `node` on `PATH` satisfies Astro’s CLI. Bun remains the package manager and script runner.
9999

100100
## Manual Deployment
101101

src/components/Footer.astro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
2+
import pkg from '../../package.json';
3+
4+
const appVersion = pkg.version;
25
const links = [
36
{
47
name: 'LinkedIn',
@@ -29,4 +32,6 @@ const links = [
2932
{name}
3033
</a>
3134
))}
35+
<span class="text-sm tabular-nums text-green-800/90 dark:text-green-200/80" data-site-version
36+
aria-label={`Site version ${appVersion}`}>v{appVersion}</span>
3237
</footer>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { expect, test } from 'bun:test';
2+
import { readFileSync } from 'node:fs';
3+
import { join } from 'node:path';
4+
5+
const root = join(import.meta.dir, '..', '..');
6+
7+
function readPackageVersion(): string {
8+
try {
9+
const raw = readFileSync(join(root, 'package.json'), 'utf8');
10+
const pkg = JSON.parse(raw) as { version?: string };
11+
if (typeof pkg.version !== 'string' || !pkg.version) {
12+
throw new Error('package.json missing version');
13+
}
14+
return pkg.version;
15+
} catch (e) {
16+
throw new Error('failed to read package.json', { cause: e });
17+
}
18+
}
19+
20+
test('Footer embeds site version from package.json', () => {
21+
const version = readPackageVersion();
22+
const footer = readFileSync(
23+
join(root, 'src/components/Footer.astro'),
24+
'utf8',
25+
);
26+
expect(version).toMatch(/^\d+\.\d+\.\d+/);
27+
expect(footer).toContain("from '../../package.json'");
28+
expect(footer).toContain('{appVersion}');
29+
expect(footer.indexOf('Links:')).toBeLessThan(
30+
footer.indexOf('data-site-version'),
31+
);
32+
});
33+
34+
test('built home page includes version in footer when dist exists', () => {
35+
const distIndex = join(root, 'dist', 'index.html');
36+
let html: string;
37+
try {
38+
html = readFileSync(distIndex, 'utf8');
39+
} catch {
40+
return;
41+
}
42+
const version = readPackageVersion();
43+
expect(html).toContain(`v${version}`);
44+
expect(html).toContain('data-site-version');
45+
});

0 commit comments

Comments
 (0)