Skip to content

Commit f337772

Browse files
authored
Merge pull request #138 from deploystackio/main
prod deployment
2 parents 152a818 + d8e4ed3 commit f337772

7 files changed

Lines changed: 98 additions & 10 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Deploy Documentation Preview
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
comment:
7+
description: 'Deployment Documentation'
8+
required: false
9+
default: 'Manual preview deployment'
10+
11+
jobs:
12+
build-and-deploy:
13+
if: github.ref_name == 'main' || github.event_name == 'workflow_dispatch'
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
deployments: write
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 20
27+
cache: npm
28+
29+
- name: Install dependencies
30+
run: |
31+
npm install
32+
33+
- name: Build frontend
34+
run: npm run build
35+
36+
- name: Deploy to Cloudflare Pages
37+
uses: cloudflare/wrangler-action@v3
38+
with:
39+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
40+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
41+
command: pages deploy out --project-name=deploystack-docs --branch=main
42+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/deploy_prod.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Deploy Documentation Production
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
comment:
7+
description: 'Deployment Documentation'
8+
required: false
9+
default: 'Manual Production deployment'
10+
11+
jobs:
12+
build-and-deploy:
13+
if: github.ref_name == 'prod' || github.event_name == 'workflow_dispatch'
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
deployments: write
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 20
27+
cache: npm
28+
29+
- name: Install dependencies
30+
run: |
31+
npm install
32+
33+
- name: Build frontend
34+
run: npm run build
35+
36+
- name: Deploy to Cloudflare Pages
37+
uses: cloudflare/wrangler-action@v3
38+
with:
39+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
40+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
41+
command: pages deploy out --project-name=deploystack-docs --branch=prod
42+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,5 @@ coverage/
7171
.jest/
7272

7373
._*.mdx
74-
._*.ts
74+
._*.ts
75+
out/

app/api/search/route.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

app/docs/sitemap.xml/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { source } from '@/lib/source';
22
import { getCanonicalUrl } from '@/lib/seo-utils';
33

4+
export const dynamic = 'force-static';
5+
export const revalidate = false;
6+
47
export async function GET() {
58
const pages = source.getPages();
69

next.config.mjs

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

1619
export default withMDX(config);

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"private": true,
66
"scripts": {
77
"dev": "next dev",
8-
"build": "next build",
8+
"build": "next build && npm run move-assets",
9+
"move-assets": "mkdir -p out/docs/_next && cp -r out/_next/* out/docs/_next/ && rm -rf out/_next",
910
"start": "next start",
1011
"lint:md": "npx markdownlint-cli2 '**/*.md' '#node_modules' '#.github'",
1112
"lint:links": "node check-links.js",

0 commit comments

Comments
 (0)