Skip to content

Commit 0fbc64a

Browse files
committed
feat: add GitHub Actions workflow for auto-deploying documentation to GitHub Pages
Signed-off-by: kaifcoder <kaifmohd2014@gmail.com>
1 parent 2046e69 commit 0fbc64a

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

.github/workflows/docs.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'docs/**'
8+
- 'package.json'
9+
- '.github/workflows/docs.yml'
10+
workflow_dispatch: {}
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: 'pages'
19+
cancel-in-progress: true
20+
21+
jobs:
22+
build-deploy:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Node
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 20
32+
cache: 'npm'
33+
34+
- name: Install deps
35+
run: npm ci
36+
37+
- name: Build VitePress site
38+
env:
39+
VITEPRESS_BASE: /create-polyglot/
40+
run: npm run docs:build
41+
42+
- name: Upload artifact
43+
uses: actions/upload-pages-artifact@v3
44+
with:
45+
path: docs/.vitepress/dist
46+
47+
- name: Deploy to GitHub Pages
48+
uses: actions/deploy-pages@v4

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,6 @@ Preview production build:
132132
npm run docs:preview
133133
```
134134
Docs source lives in `docs/` with sidebar-driven structure defined in `docs/.vitepress/config.mjs`.
135+
136+
### Deployment
137+
Docs are auto-deployed to GitHub Pages on pushes to `main` that touch `docs/` via `.github/workflows/docs.yml`. The base path is set using `VITEPRESS_BASE=/create-polyglot/`.

docs/.vitepress/config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { defineConfig } from 'vitepress';
22

33
export default defineConfig({
4+
// Adjust base for GitHub Pages project site. When deploying under
5+
// https://<user>.github.io/<repo>/ the base must be '/<repo>/'. The workflow
6+
// sets VITEPRESS_BASE automatically; local dev stays '/'.
7+
base: process.env.VITEPRESS_BASE || '/',
48
title: 'create-polyglot',
59
description: 'Scaffold polyglot microservice monorepos (Node, Python, Go, Java, Next.js)',
610
head: [

0 commit comments

Comments
 (0)