This commit introduces a significant restructuring of the documentation deployment and content strategy to support a gradual migration from Nextra to Astro. - **New Astro Workflow (`jan-astro-docs.yml`)**: Implemented a new, separate GitHub Actions workflow to build and deploy the Astro site from the `/website` directory to a new subdomain (`v2.jan.ai`). This isolates the new site from the existing one, allowing for independent development and testing. - **Removed Combined Workflow**: Deleted the previous, more complex combined workflow (`jan-combined-docs.yml`) and its associated test scripts to simplify the deployment process and eliminate routing conflicts. - **Astro Config Update**: Simplified the Astro configuration (`astro.config.mjs`) by removing the conditional `base` path. The Astro site is now configured to deploy to the root of its own subdomain. - **Mirrored Content**: Recreated the entire `/products` section from the Astro site within the Nextra site at `/docs/src/pages/products`. This provides content parity and a consistent user experience on both platforms during the transition period. - **File Structure**: Established a clear, organized structure for platforms, models, and tools within the Nextra `products` directory. - **Nextra Sidebar Fix**: Implemented the correct `_meta.json` structure for the new products section. Created nested meta files to build a collapsible sidebar, fixing the UI bug that caused duplicated navigation items. - **"Coming Soon" Pages**: Added clear, concise "Coming Soon" and "In Development" banners and content for upcoming products like Jan V1, Mobile, Server, and native Tools, ensuring consistent messaging across both sites. - **.gitignore**: Updated the root `.gitignore` to properly exclude build artifacts, caches, and environment files for both the Nextra (`/docs`) and Astro (`/website`) projects. - **Repository Cleanup**: Removed temporary and unused files related to the previous combined deployment attempt. This new architecture provides a stable, predictable, and low-risk path for migrating our documentation to Astro while ensuring the current production site remains unaffected.
76 lines
2.4 KiB
YAML
76 lines
2.4 KiB
YAML
name: Deploy Astro Docs (v2)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
paths:
|
|
- 'website/**'
|
|
- '.github/workflows/jan-astro-docs.yml'
|
|
pull_request:
|
|
paths:
|
|
- 'website/**'
|
|
- '.github/workflows/jan-astro-docs.yml'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Deploy to v2.jan.ai
|
|
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
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
deployments: write
|
|
pull-requests: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Install dependencies
|
|
working-directory: website
|
|
run: npm install
|
|
|
|
- name: Build Astro Docs
|
|
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
|
|
|
|
- name: Publish to Cloudflare Pages (PR Preview)
|
|
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
|
|
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Add PR Comment with Preview URL
|
|
if: github.event_name == 'pull_request'
|
|
uses: mshick/add-pr-comment@v2
|
|
with:
|
|
message: |
|
|
🚀 Astro docs preview is ready!
|
|
URL: ${{ steps.deployPreview.outputs.url }}
|
|
|
|
- name: Publish to Cloudflare Pages (Production)
|
|
if: (github.event_name == 'push' && github.ref == 'refs/heads/dev') || (github.event_name == 'workflow_dispatch')
|
|
uses: cloudflare/pages-action@v1
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
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
|
|
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|