Skip to content

Commit ec9d731

Browse files
committed
feat: publish docs and storybook to GitHub Pages
- Configure Astro base path for /mono/docs - Configure Storybook base path for /mono/storybook - Add unified deploy-pages workflow (replaces publish-storybook) - Add landing page with links to both docs and storybook - Workflow triggers on main branch push and manual dispatch
1 parent 4bcf0a6 commit ec9d731

File tree

4 files changed

+119
-24
lines changed

4 files changed

+119
-24
lines changed

.github/pages-index.html

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>xray</title>
7+
<style>
8+
* {
9+
margin: 0;
10+
padding: 0;
11+
box-sizing: border-box;
12+
}
13+
body {
14+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
15+
min-height: 100vh;
16+
display: flex;
17+
align-items: center;
18+
justify-content: center;
19+
background: #0a0a0a;
20+
color: #fafafa;
21+
}
22+
.container {
23+
text-align: center;
24+
padding: 2rem;
25+
}
26+
h1 {
27+
font-size: 3rem;
28+
font-weight: 700;
29+
margin-bottom: 0.5rem;
30+
}
31+
p {
32+
color: #a1a1aa;
33+
margin-bottom: 2rem;
34+
}
35+
.links {
36+
display: flex;
37+
gap: 1rem;
38+
justify-content: center;
39+
flex-wrap: wrap;
40+
}
41+
a {
42+
display: inline-block;
43+
padding: 0.75rem 1.5rem;
44+
border-radius: 0.5rem;
45+
text-decoration: none;
46+
font-weight: 500;
47+
transition: opacity 0.2s;
48+
}
49+
a:hover {
50+
opacity: 0.8;
51+
}
52+
.docs {
53+
background: #3b82f6;
54+
color: white;
55+
}
56+
.storybook {
57+
background: #ff4785;
58+
color: white;
59+
}
60+
</style>
61+
</head>
62+
<body>
63+
<div class="container">
64+
<h1>xray</h1>
65+
<p>Design token validation and visualization toolkit</p>
66+
<div class="links">
67+
<a href="/mono/docs/" class="docs">Documentation</a>
68+
<a href="/mono/storybook/" class="storybook">Storybook</a>
69+
</div>
70+
</div>
71+
</body>
72+
</html>
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
name: Publish Storybook to GitHub Pages
1+
name: Deploy Docs & Storybook to GitHub Pages
22

33
on:
44
push:
55
branches:
6-
- publish
6+
- main
7+
workflow_dispatch:
78

89
permissions:
910
contents: read
@@ -37,16 +38,26 @@ jobs:
3738
- name: Install dependencies
3839
run: bun install
3940

41+
- name: Build Docs
42+
run: bun run --filter docs build
43+
4044
- name: Build Storybook
4145
run: bun run --filter @xray/ui storybook:build
4246

47+
- name: Prepare combined output
48+
run: |
49+
mkdir -p _site/docs _site/storybook
50+
cp -r packages/docs/dist/* _site/docs/
51+
cp -r packages/ui/storybook-static/* _site/storybook/
52+
cp .github/pages-index.html _site/index.html
53+
4354
- name: Setup Pages
4455
uses: actions/configure-pages@v5
4556

4657
- name: Upload artifact
4758
uses: actions/upload-pages-artifact@v3
4859
with:
49-
path: packages/ui/storybook-static
60+
path: _site
5061

5162
deploy:
5263
environment:

packages/docs/astro.config.mjs

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
11
// @ts-check
2-
import { defineConfig } from 'astro/config';
3-
import starlight from '@astrojs/starlight';
2+
import { defineConfig } from "astro/config";
3+
import starlight from "@astrojs/starlight";
44

55
// https://astro.build/config
66
export default defineConfig({
7-
integrations: [
8-
starlight({
9-
title: 'My Docs',
10-
social: [{ icon: 'github', label: 'GitHub', href: 'https://github.com/withastro/starlight' }],
11-
sidebar: [
12-
{
13-
label: 'Guides',
14-
items: [
15-
// Each item here is one entry in the navigation menu.
16-
{ label: 'Example Guide', slug: 'guides/example' },
17-
],
18-
},
19-
{
20-
label: 'Reference',
21-
autogenerate: { directory: 'reference' },
22-
},
23-
],
24-
}),
25-
],
7+
site: "https://xrayjs.github.io",
8+
base: "/mono/docs",
9+
integrations: [
10+
starlight({
11+
title: "My Docs",
12+
social: [
13+
{
14+
icon: "github",
15+
label: "GitHub",
16+
href: "https://github.com/withastro/starlight",
17+
},
18+
],
19+
sidebar: [
20+
{
21+
label: "Guides",
22+
items: [
23+
// Each item here is one entry in the navigation menu.
24+
{ label: "Example Guide", slug: "guides/example" },
25+
],
26+
},
27+
{
28+
label: "Reference",
29+
autogenerate: { directory: "reference" },
30+
},
31+
],
32+
}),
33+
],
2634
});

packages/ui/.storybook/main.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ export default defineMain({
1919
"../src/stories/**/*.mdx",
2020
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)",
2121
],
22+
viteFinal: (config) => {
23+
config.base = "/mono/storybook/";
24+
return config;
25+
},
2226
});

0 commit comments

Comments
 (0)