Skip to content

Commit 40af3dd

Browse files
committed
ci(docs): add GitHub Pages deployment workflow
- Update next.config.mjs for static export with GitHub Pages support - Add basePath and assetPrefix for /acton-reactive/ subdirectory - Create docs.yml workflow to build and deploy on push to main - Workflow triggers on changes to acton-docs-site/ or workflow file
1 parent 73c1ced commit 40af3dd

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

.github/workflows/docs.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
paths:
7+
- 'acton-docs-site/**'
8+
- '.github/workflows/docs.yml'
9+
workflow_dispatch:
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: false
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
defaults:
26+
run:
27+
working-directory: acton-docs-site
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Setup Node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: "20"
36+
cache: 'npm'
37+
cache-dependency-path: acton-docs-site/package-lock.json
38+
39+
- name: Setup Pages
40+
uses: actions/configure-pages@v5
41+
42+
- name: Install dependencies
43+
run: npm ci
44+
45+
- name: Build with Next.js
46+
run: npm run build
47+
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v3
50+
with:
51+
path: acton-docs-site/out
52+
53+
deploy:
54+
environment:
55+
name: github-pages
56+
url: ${{ steps.deployment.outputs.page_url }}
57+
runs-on: ubuntu-latest
58+
needs: build
59+
steps:
60+
- name: Deploy to GitHub Pages
61+
id: deployment
62+
uses: actions/deploy-pages@v4

acton-docs-site/next.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ import withSearch from './src/markdoc/search.mjs'
55
/** @type {import('next').NextConfig} */
66
const nextConfig = {
77
pageExtensions: ['js', 'jsx', 'md', 'ts', 'tsx'],
8+
output: 'export',
9+
images: {
10+
unoptimized: true,
11+
},
12+
// Base path for GitHub Pages (repo name)
13+
basePath: process.env.GITHUB_ACTIONS ? '/acton-reactive' : '',
14+
// Asset prefix for GitHub Pages
15+
assetPrefix: process.env.GITHUB_ACTIONS ? '/acton-reactive/' : '',
816
}
917

1018
export default withSearch(

0 commit comments

Comments
 (0)