chore: create astro docs cicd

This commit is contained in:
hiento09 2025-07-29 16:59:17 +07:00
parent a48925f6bc
commit 1ff86e237f
11 changed files with 65 additions and 52 deletions

View File

@ -1,4 +1,4 @@
name: Deploy Astro Docs (v2)
name: Jan Astro Docs
on:
push:
@ -11,58 +11,81 @@ on:
paths:
- 'website/**'
- '.github/workflows/jan-astro-docs.yml'
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
workflow_dispatch:
jobs:
deploy:
name: Deploy to v2.jan.ai
name: Deploy to CloudFlare Pages
env:
# IMPORTANT: You will need to create a new Cloudflare Pages project
# and name it "jan-v2" or update this value to your new project name.
CLOUDFLARE_PROJECT_NAME: jan-v2
CLOUDFLARE_PROJECT_NAME: astro-docs
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
deployments: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- uses: oven-sh/setup-bun@v2
- name: Install jq
uses: dcarbone/install-jq-action@v2.0.1
- name: Fill env vars
continue-on-error: true
working-directory: website
run: |
env_example_file=".env.example"
touch .env
while IFS= read -r line || [[ -n "$line" ]]; do
if [[ "$line" == *"="* ]]; then
var_name=$(echo $line | cut -d '=' -f 1)
echo $var_name
var_value="$(jq -r --arg key "$var_name" '.[$key]' <<< "$SECRETS")"
echo "$var_name=$var_value" >> .env
fi
done < "$env_example_file"
env:
SECRETS: '${{ toJson(secrets) }}'
- name: Install dependencies
working-directory: website
run: npm install
- name: Build Astro Docs
run: bun install
- name: Build website
working-directory: website
# No PUBLIC_BASE_PATH is set, so it builds for the root, which is correct for a subdomain
run: npm run build
run: bun run build
- name: Publish to Cloudflare Pages (PR Preview)
- name: copy redirects and headers
continue-on-error: true
working-directory: website
run: |
cp _redirects dist/_redirects
cp _headers dist/_headers
- name: Publish to Cloudflare Pages PR Preview and Staging
if: github.event_name == 'pull_request'
uses: cloudflare/pages-action@v1
id: deployPreview
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ env.CLOUDFLARE_PROJECT_NAME }}
directory: ./website/dist
# Optional: Enable this if you want to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
id: deployCloudflarePages
- name: Add PR Comment with Preview URL
- uses: mshick/add-pr-comment@v2
if: github.event_name == 'pull_request'
uses: mshick/add-pr-comment@v2
with:
message: |
🚀 Astro docs preview is ready!
URL: ${{ steps.deployPreview.outputs.url }}
Preview URL Astro Docs: ${{ steps.deployCloudflarePages.outputs.url }}
- name: Publish to Cloudflare Pages (Production)
- name: Publish to Cloudflare Pages Production
if: (github.event_name == 'push' && github.ref == 'refs/heads/dev') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev')
uses: cloudflare/pages-action@v1
with:
@ -70,6 +93,6 @@ jobs:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ env.CLOUDFLARE_PROJECT_NAME }}
directory: ./website/dist
# This deploys to the production branch of your new Cloudflare project
branch: main
# Optional: Enable this if you want to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

6
.gitignore vendored
View File

@ -77,3 +77,9 @@ docs/.next/
# Combined output for local testing
combined-output/
# vscode
.vscode/
# yarn
.yarnrc.yml

View File

@ -1,3 +0,0 @@
nmHoistingLimits: workspaces
nodeLinker: node-modules
checksumBehavior: update

View File

@ -1,4 +0,0 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}

View File

@ -1,11 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}

View File

@ -96,6 +96,7 @@ export default defineConfig({
{
label: 'Local Server',
items: [
{ label: 'Introduction', link: '/local-server/' },
{ label: 'Server Setup', slug: 'local-server/api-server' },
{
label: 'Jan Data Folder',

View File

@ -9,8 +9,9 @@
"astro": "^5.6.1",
"astro-mermaid": "^1.0.4",
"gsap": "^3.13.0",
"mermaid": "^11.9.0",
"phosphor-astro": "^2.1.0",
"sharp": "^0.34.2",
"sharp": "^0.34.3",
"starlight-openapi": "^0.19.1",
"starlight-sidebar-topics": "^0.6.0",
"starlight-theme-rapide": "^0.5.1",

View File

@ -15,11 +15,13 @@
"astro": "^5.6.1",
"astro-mermaid": "^1.0.4",
"gsap": "^3.13.0",
"mermaid": "^11.9.0",
"phosphor-astro": "^2.1.0",
"sharp": "^0.34.2",
"sharp": "^0.34.3",
"starlight-openapi": "^0.19.1",
"starlight-sidebar-topics": "^0.6.0",
"starlight-theme-rapide": "^0.5.1",
"starlight-videos": "^0.3.0"
}
},
"packageManager": "yarn@1.22.22"
}

View File

@ -53,7 +53,7 @@ For an overview of Jan Local Server, see the [Local Server introduction](./index
## API Usage
```jan/website/src/content/docs/local-server/api-server.mdx#L69-80
```bash
curl http://127.0.0.1:1337/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer testing-something" \

View File

@ -6,7 +6,6 @@ sidebar:
banner:
content: 'In Development: This tool is planned and not yet available.'
---
import { Aside, Card, CardGrid } from '@astrojs-starlight/components';
## Let Jan Use Your Browser
@ -14,9 +13,9 @@ import { Aside, Card, CardGrid } from '@astrojs-starlight/components';
Think of it as an integrated, privacy-first automation layer that turns Jan from a conversational AI into a powerful agent for action.
<Aside type="note">
:::note
**This tool is not yet available.** We are designing `BrowserUse` to be a core component of Jan's agentic capabilities.
</Aside>
:::
### Inspired by the Best
@ -26,11 +25,10 @@ While tools like [Browser Use](https://docs.browser-use.com/introduction) exist
The tool will be implemented as a native **Model Context Protocol (MCP)** server within Jan, ensuring secure and standardized communication between the AI model and the browser. This allows for powerful, auditable, and secure web interactions.
---
### Planned Core Features:
- **Secure Sessions**: All browsing activity happens in an isolated, sandboxed environment.
- **Natural Language Control**: Simply tell Jan what you want to do (e.g., "Book a flight," "Research this topic and summarize the top 5 findings," "Apply for this job for me").
- **Visual Understanding**: Jan will be able to see and interpret the content on pages, not just the underlying code.
- **User in the Loop**: Always ask for permission before taking critical actions like submitting forms or making purchases.
---