π docs: fix Cloudflare auto-deploy β Node 22 pin (.nvmrc+engines), correct site URL (pages.dev), wrangler deploy workflow
swadhinbiswas committed 2 months ago
dc04bd7
1 parent 227afa4
commit dc04bd7
4 files changed
+47 -3
Showing 4 changed files+47-3
βΌ.github/workflows/docs-deploy.yml
+40-0
| @@ -0,0 +1,40 @@ | ||
1 | +name: Deploy Docs to Cloudflare Pages | |
2 | + | |
3 | +on: | |
4 | + push: | |
5 | + branches: [main] | |
6 | + paths: ['docs_site/**'] | |
7 | + workflow_dispatch: | |
8 | + | |
9 | +permissions: | |
10 | + contents: read | |
11 | + | |
12 | +jobs: | |
13 | + deploy: | |
14 | + name: Build & Deploy Docs | |
15 | + runs-on: ubuntu-latest | |
16 | + # Requires repo secret CLOUDFLARE_API_TOKEN (token with Pages:Edit permission) | |
17 | + # and CLOUDFLARE_ACCOUNT_ID. Set both in Settings β Secrets β Actions. | |
18 | + steps: | |
19 | + - uses: actions/checkout@v4 | |
20 | + | |
21 | + - uses: actions/setup-node@v4 | |
22 | + with: | |
23 | + node-version: 22 | |
24 | + cache: npm | |
25 | + cache-dependency-path: docs_site/package-lock.json | |
26 | + | |
27 | + - name: Install dependencies | |
28 | + working-directory: docs_site | |
29 | + run: npm ci | |
30 | + | |
31 | + - name: Build | |
32 | + working-directory: docs_site | |
33 | + run: npm run build | |
34 | + | |
35 | + - name: Deploy to Cloudflare Pages | |
36 | + uses: cloudflare/wrangler-action@v3 | |
37 | + with: | |
38 | + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
39 | + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
40 | + command: pages deploy docs_site/dist --project-name=justapi-docs --branch=main | |
0 | 41 | |
βΌdocs_site/.nvmrc
+1-0
| @@ -0,0 +1 @@ | ||
1 | +22 | |
0 | 2 | |
βΌdocs_site/astro.config.mjs
+3-3
| @@ -2,7 +2,7 @@ import { defineConfig } from 'astro/config'; | ||
2 | 2 | import starlight from '@astrojs/starlight'; |
3 | 3 | import sitemap from '@astrojs/sitemap'; |
4 | 4 | |
5 | -const site = 'https://justapi.dev'; | |
5 | +const site = 'https://justapi.pages.dev'; | |
6 | 6 | |
7 | 7 | export default defineConfig({ |
8 | 8 | site, |
| @@ -74,7 +74,7 @@ export default defineConfig({ | ||
74 | 74 | { tag: 'meta', attrs: { property: 'og:site_name', content: 'JustAPI' } }, |
75 | 75 | { tag: 'meta', attrs: { property: 'og:title', content: 'JustAPI β Built to Handle Pressure' } }, |
76 | 76 | { tag: 'meta', attrs: { property: 'og:description', content: 'Python web framework powered by Rust. Handles 700k+ requests per second. FastAPI alternative with 20Γ performance.' } }, |
77 | - { tag: 'meta', attrs: { property: 'og:image', content: 'https://justapi.dev/og-image.png' } }, | |
77 | + { tag: 'meta', attrs: { property: 'og:image', content: 'https://justapi.pages.dev/og-image.png' } }, | |
78 | 78 | { tag: 'meta', attrs: { property: 'og:image:width', content: '1200' } }, |
79 | 79 | { tag: 'meta', attrs: { property: 'og:image:height', content: '630' } }, |
80 | 80 | { tag: 'meta', attrs: { property: 'og:image:alt', content: 'JustAPI β Python web framework powered by Rust' } }, |
| @@ -82,7 +82,7 @@ export default defineConfig({ | ||
82 | 82 | { tag: 'meta', attrs: { name: 'twitter:card', content: 'summary_large_image' } }, |
83 | 83 | { tag: 'meta', attrs: { name: 'twitter:title', content: 'JustAPI β Built to Handle Pressure' } }, |
84 | 84 | { tag: 'meta', attrs: { name: 'twitter:description', content: 'Python web framework powered by Rust. 700k+ requests per second. FastAPI alternative.' } }, |
85 | - { tag: 'meta', attrs: { name: 'twitter:image', content: 'https://justapi.dev/og-image.png' } }, | |
85 | + { tag: 'meta', attrs: { name: 'twitter:image', content: 'https://justapi.pages.dev/og-image.png' } }, | |
86 | 86 | { |
87 | 87 | tag: 'script', |
88 | 88 | attrs: { type: 'application/ld+json' }, |
89 | 89 | |
βΌdocs_site/package.json
+3-0
| @@ -13,5 +13,8 @@ | ||
13 | 13 | "@astrojs/sitemap": "^3.7.3", |
14 | 14 | "@astrojs/starlight": "^0.41.4", |
15 | 15 | "astro": "^7.1.3" |
16 | + }, | |
17 | + "engines": { | |
18 | + "node": ">=22.12.0" | |
16 | 19 | } |
17 | 20 | } |
18 | 21 | |