From 1ff86e237f690ba6cc63f8cdbb30f99455a9c401 Mon Sep 17 00:00:00 2001 From: hiento09 Date: Tue, 29 Jul 2025 16:59:17 +0700 Subject: [PATCH] chore: create astro docs cicd --- .github/workflows/jan-astro-docs.yml | 71 ++++++++++++------- .gitignore | 6 ++ .yarnrc.yml | 3 - website/.vscode/extensions.json | 4 -- website/.vscode/launch.json | 11 --- website/PRODUCTS_PAGE_README.md | 2 +- website/astro.config.mjs | 1 + website/bun.lock | 3 +- website/package.json | 6 +- .../content/docs/local-server/api-server.mdx | 2 +- .../src/content/products/tools/browseruse.mdx | 8 +-- 11 files changed, 65 insertions(+), 52 deletions(-) delete mode 100644 .yarnrc.yml delete mode 100644 website/.vscode/extensions.json delete mode 100644 website/.vscode/launch.json diff --git a/.github/workflows/jan-astro-docs.yml b/.github/workflows/jan-astro-docs.yml index 511b1cc96..b551d847d 100644 --- a/.github/workflows/jan-astro-docs.yml +++ b/.github/workflows/jan-astro-docs.yml @@ -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 }} diff --git a/.gitignore b/.gitignore index a20f96c30..9f6735802 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,9 @@ docs/.next/ # Combined output for local testing combined-output/ + +# vscode +.vscode/ + +# yarn +.yarnrc.yml \ No newline at end of file diff --git a/.yarnrc.yml b/.yarnrc.yml deleted file mode 100644 index 74febbee3..000000000 --- a/.yarnrc.yml +++ /dev/null @@ -1,3 +0,0 @@ -nmHoistingLimits: workspaces -nodeLinker: node-modules -checksumBehavior: update diff --git a/website/.vscode/extensions.json b/website/.vscode/extensions.json deleted file mode 100644 index 22a15055d..000000000 --- a/website/.vscode/extensions.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "recommendations": ["astro-build.astro-vscode"], - "unwantedRecommendations": [] -} diff --git a/website/.vscode/launch.json b/website/.vscode/launch.json deleted file mode 100644 index d64220976..000000000 --- a/website/.vscode/launch.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "command": "./node_modules/.bin/astro dev", - "name": "Development server", - "request": "launch", - "type": "node-terminal" - } - ] -} diff --git a/website/PRODUCTS_PAGE_README.md b/website/PRODUCTS_PAGE_README.md index 54299c01b..e4a1188be 100644 --- a/website/PRODUCTS_PAGE_README.md +++ b/website/PRODUCTS_PAGE_README.md @@ -303,4 +303,4 @@ When adding new components or effects: --- -*Created with ❤️ and a healthy dose of 80s nostalgia* \ No newline at end of file +*Created with ❤️ and a healthy dose of 80s nostalgia* diff --git a/website/astro.config.mjs b/website/astro.config.mjs index c13290f1d..63d93bea6 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -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', diff --git a/website/bun.lock b/website/bun.lock index 9ec213e17..09e4c8323 100644 --- a/website/bun.lock +++ b/website/bun.lock @@ -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", diff --git a/website/package.json b/website/package.json index de97498a9..895c7e11e 100644 --- a/website/package.json +++ b/website/package.json @@ -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" } diff --git a/website/src/content/docs/local-server/api-server.mdx b/website/src/content/docs/local-server/api-server.mdx index 88e60d145..5a8470473 100644 --- a/website/src/content/docs/local-server/api-server.mdx +++ b/website/src/content/docs/local-server/api-server.mdx @@ -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" \ diff --git a/website/src/content/products/tools/browseruse.mdx b/website/src/content/products/tools/browseruse.mdx index 04f7c729f..824639ae3 100644 --- a/website/src/content/products/tools/browseruse.mdx +++ b/website/src/content/products/tools/browseruse.mdx @@ -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. - +::: ### 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. +--- \ No newline at end of file