Skip to content

Commit b1aa271

Browse files
ci(github-actions): update deploy workflow and optimize template context processing
- Update GitHub Actions workflow for deploying VitePress site - Restrict workflow to run on pushes to 'docs' directory - Use Bun package manager for improved performance - Refactor template context processing to support synchronous and asynchronous context processors
1 parent 092f268 commit b1aa271

3 files changed

Lines changed: 19 additions & 15 deletions

File tree

.github/workflows/deploy-docs.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Sample workflow for building and deploying a VitePress site to GitHub Pages
22
#
3-
name: Deploy Nexios Docs
3+
name: Deploy VitePress site to Pages
44

55
on:
66
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
77
# using the `master` branch as the default branch.
88
push:
99
branches: [main]
10+
paths:
11+
- "docs/**"
1012

1113
# Allows you to run this workflow manually from the Actions tab
1214
workflow_dispatch:
@@ -31,22 +33,21 @@ jobs:
3133
- name: Checkout
3234
uses: actions/checkout@v4
3335
with:
34-
fetch-depth: 0 # Not needed if lastUpdated is not enabled
35-
- uses: pnpm/action-setup@v3 # Uncomment this block if you're using pnpm
36-
with:
37-
version: 9 # Not needed if you've set "packageManager" in package.json
38-
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
39-
- name: Setup Node
40-
uses: actions/setup-node@v4
41-
with:
42-
node-version: 22
43-
cache: pnpm # or pnpm / yarn
36+
fetch-depth: 0
37+
38+
- uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
39+
4440
- name: Setup Pages
4541
uses: actions/configure-pages@v4
42+
4643
- name: Install dependencies
47-
run: pnpm install --no-frozen-lockfile
44+
working-directory: ./docs
45+
run: bun ci
46+
4847
- name: Build with VitePress
49-
run: pnpm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
48+
working-directory: ./docs
49+
run: bun run docs:build
50+
5051
- name: Upload artifact
5152
uses: actions/upload-pages-artifact@v3
5253
with:

docs/intro/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Nexios is a high-performance Python web framework designed for speed, flexibilit
44

55
## Key Features
66

7-
- **Blazing Fast**: Built on a native Rust engine for maximum performance
87
- **Pythonic**: Clean, intuitive API that's easy to learn and use
98
- **ASGI Compatible**: Fully compatible with ASGI for async support
109
- **RESTful API Ready**: Built-in support for creating RESTful APIs

nexios/templating/middleware.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from nexios.middleware import BaseMiddleware
88
from nexios.types import Request, Response
9+
from nexios.utils.async_helpers import is_async_callable
910

1011

1112
class TemplateContextMiddleware(BaseMiddleware):
@@ -32,7 +33,10 @@ async def __call__(
3233
context = self.default_context.copy()
3334

3435
if self.context_processor:
35-
request_context = await self.context_processor(request)
36+
if not is_async_callable(self.context_processor):
37+
request_context = self.context_processor(request)
38+
else:
39+
request_context = await self.context_processor(request)
3640
context.update(request_context)
3741

3842
context.update(

0 commit comments

Comments
 (0)