Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/deploy_preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy Documentation Preview

on:
workflow_dispatch:
inputs:
comment:
description: 'Deployment Documentation'
required: false
default: 'Manual preview deployment'

jobs:
build-and-deploy:
if: github.ref_name == 'main' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Install dependencies
run: |
npm install

- name: Build frontend
run: npm run build

- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy out --project-name=deploystack-docs --branch=main
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/deploy_prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy Documentation Production

on:
workflow_dispatch:
inputs:
comment:
description: 'Deployment Documentation'
required: false
default: 'Manual Production deployment'

jobs:
build-and-deploy:
if: github.ref_name == 'prod' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Install dependencies
run: |
npm install

- name: Build frontend
run: npm run build

- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy out --project-name=deploystack-docs --branch=prod
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@ coverage/
.jest/

._*.mdx
._*.ts
._*.ts
out/
4 changes: 0 additions & 4 deletions app/api/search/route.ts

This file was deleted.

3 changes: 3 additions & 0 deletions app/docs/sitemap.xml/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { source } from '@/lib/source';
import { getCanonicalUrl } from '@/lib/seo-utils';

export const dynamic = 'force-static';
export const revalidate = false;

export async function GET() {
const pages = source.getPages();

Expand Down
11 changes: 7 additions & 4 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ const withMDX = createMDX();
/** @type {import('next').NextConfig} */
const config = {
reactStrictMode: true,
output: 'export', // Enable static HTML export
trailingSlash: true, // Required for static export
basePath: '/docs', // Set base path for the application
assetPrefix: '/docs', // Ensure assets are also prefixed with /docs
images: {
unoptimized: true // Required for static export
},
// Sitemap is now handled by app/docs/sitemap.xml/route.ts
// If you have other Next.js configurations, add them here
// For example, if you need to serve static files from the 'public' directory
// and your images are in 'docs/assets/images', you might need to configure images domain
// or ensure they are moved to 'public/docs/assets/images' and referenced accordingly.
// For now, we'll stick to the basic config.
};

export default withMDX(config);
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build": "next build && npm run move-assets",
"move-assets": "mkdir -p out/docs/_next && cp -r out/_next/* out/docs/_next/ && rm -rf out/_next",
"start": "next start",
"lint:md": "npx markdownlint-cli2 '**/*.md' '#node_modules' '#.github'",
"lint:links": "node check-links.js",
Expand Down