Skip to content

Commit 575232a

Browse files
committed
initial website source and build workflow
1 parent 422a4f7 commit 575232a

9 files changed

Lines changed: 9675 additions & 0 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Check Build Documentation Site
2+
3+
on:
4+
pull_request:
5+
6+
paths:
7+
- "docs/website-src/**"
8+
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: false
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
#- name: LikeC4 code generation
28+
# uses: likec4/actions@v1
29+
# with:
30+
# codegen: react
31+
# path: website/likec4_src
32+
# output: website/likec4_react/likec4.generated.js
33+
34+
#- name: LikeC4 PNG export
35+
# uses: likec4/actions@v1
36+
# with:
37+
# export: png
38+
# path: website/likec4_src
39+
# output: website/public/images/likec4
40+
41+
- name: Detect package manager
42+
id: detect-package-manager
43+
run: |
44+
if [ -f "docs/website-src/yarn.lock" ]; then
45+
echo "manager=yarn" >> $GITHUB_OUTPUT
46+
echo "command=install" >> $GITHUB_OUTPUT
47+
echo "runner=yarn" >> $GITHUB_OUTPUT
48+
exit 0
49+
elif [ -f "docs/website-src/package.json" ]; then
50+
echo "manager=npm" >> $GITHUB_OUTPUT
51+
echo "command=ci" >> $GITHUB_OUTPUT
52+
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
53+
exit 0
54+
else
55+
echo "Unable to determine package manager"
56+
exit 1
57+
fi
58+
59+
- name: Setup Node
60+
uses: actions/setup-node@v4
61+
with:
62+
node-version: "20"
63+
64+
- name: Setup Pages
65+
uses: actions/configure-pages@v5
66+
67+
- name: Restore cache
68+
uses: actions/cache@v4
69+
with:
70+
path: |
71+
.next/cache
72+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
73+
restore-keys: |
74+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
75+
76+
- name: Install dependencies
77+
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
78+
working-directory: docs/website-src
79+
80+
- name: Build with Next.js
81+
run: ${{ steps.detect-package-manager.outputs.runner }} next build
82+
working-directory: docs/website-src
83+
84+
- name: Copy built files to docs
85+
run: |
86+
rm -rf docs/website/*
87+
cp -r docs/website-src/out docs/website/
88+
89+
- name: Upload artifact
90+
uses: actions/upload-pages-artifact@v3
91+
with:
92+
path: docs/website

docs/website-src/next.config.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/** @type {import('next').NextConfig} */
2+
import nextra from "nextra";
3+
4+
const nextConfig = {
5+
reactStrictMode: true,
6+
images: {
7+
unoptimized: true,
8+
},
9+
distDir: "out",
10+
output: "export",
11+
basePath: "",
12+
assetPrefix: "",
13+
};
14+
15+
const withNextra = nextra({
16+
theme: "nextra-theme-docs",
17+
themeConfig: "./theme.config.tsx",
18+
});
19+
20+
export default withNextra(nextConfig);

0 commit comments

Comments
 (0)