Skip to content

Commit cbc5108

Browse files
Merge pull request finos#2547 from rocketstack-matt/fix/advent-astro-v6-content-collections
fix(advent): migrate website to Astro v6 content collections + PR build check
2 parents e4b3335 + 0e6641e commit cbc5108

5 files changed

Lines changed: 48 additions & 11 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build Advent Website
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
branches:
9+
- 'main'
10+
- 'release*'
11+
paths:
12+
- 'advent-of-calm/**'
13+
14+
jobs:
15+
build-advent-website:
16+
name: Build Advent Website
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout PR Branch
21+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
25+
with:
26+
node-version: 24
27+
cache: npm
28+
cache-dependency-path: advent-of-calm/website/package-lock.json
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
working-directory: advent-of-calm/website
33+
34+
- name: Build Advent Website
35+
run: npm run build
36+
working-directory: advent-of-calm/website

advent-of-calm/website/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

advent-of-calm/website/src/content/config.ts renamed to advent-of-calm/website/src/content.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { defineCollection } from 'astro:content';
2+
import { glob } from 'astro/loaders';
23

34
const daysCollection = defineCollection({
4-
type: 'content',
5+
loader: glob({ pattern: '**/*.md', base: './src/content/days' }),
56
});
67

78
export const collections = {

advent-of-calm/website/src/pages/day/[day].astro

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
22
import Layout from '../../layouts/Layout.astro';
33
import { getDayTitle } from '../../utils/calendar';
4-
import { getCollection } from 'astro:content';
4+
import { getCollection, render } from 'astro:content';
55
66
export async function getStaticPaths() {
77
const allDays = await getCollection('days');
8-
8+
99
return allDays.map(entry => ({
10-
params: { day: entry.slug.replace('day-', '') },
10+
params: { day: entry.id.replace('day-', '') },
1111
props: { entry }
1212
}));
1313
}
1414
1515
const { entry } = Astro.props;
16-
const { Content } = await entry.render();
17-
const dayNum = parseInt(entry.slug.replace('day-', ''));
16+
const { Content } = await render(entry);
17+
const dayNum = parseInt(entry.id.replace('day-', ''));
1818
1919
const title = getDayTitle(dayNum);
2020
const prevDay = dayNum > 1 ? dayNum - 1 : null;

advent-of-calm/website/src/pages/setup.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
import Layout from '../layouts/Layout.astro';
3-
import { getEntry } from 'astro:content';
3+
import { getEntry, render } from 'astro:content';
44
55
const entry = await getEntry('days', 'setup');
66
if (!entry) {
77
throw new Error('Setup content not found');
88
}
9-
const { Content } = await entry.render();
9+
const { Content } = await render(entry);
1010
---
1111

1212
<Layout title="Setup - Keeping Your CALM Tools Up to Date" description="Learn how to keep your CALM CLI, VS Code Extension, and Copilot Agent up to date">

0 commit comments

Comments
 (0)