Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Docs

on:
push:
branches:
- main
- master
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
pull_request:
branches:
- main
- master
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
workflow_dispatch:

concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
name: Build VitePress docs
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: docs/package-lock.json

- name: Install dependencies
run: npm ci

- name: Build docs
env:
DOCS_BASE: ${{ github.event_name == 'pull_request' && '/' || '/SpringNote/' }}
run: npm run build

- name: Upload Pages artifact
if: github.event_name != 'pull_request' && (github.ref_name == 'main' || github.ref_name == 'master')
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist

deploy:
name: Deploy GitHub Pages
if: github.event_name != 'pull_request' && (github.ref_name == 'main' || github.ref_name == 'master')
needs: build
runs-on: ubuntu-latest

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Configure Pages
uses: actions/configure-pages@v5

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 2 additions & 1 deletion docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { defineConfig } from 'vitepress'
export default defineConfig({
title: 'SpringNote',
description: 'AI-native note taking for daily work, memory, and review.',
base: process.env.DOCS_BASE || '/',
cleanUrls: true,
lastUpdated: true,
head: [
['link', { rel: 'icon', href: '/images/logo.png' }],
['link', { rel: 'icon', href: `${process.env.DOCS_BASE || '/'}images/logo.png` }],
['meta', { name: 'theme-color', content: '#16b981' }]
],
locales: {
Expand Down
2 changes: 1 addition & 1 deletion docs/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ hero:

<div class="hero-actions">
<a class="primary" href="https://github.com/Radiant303/SpringNote/releases/latest">Download latest</a>
<a href="/en/features">Read docs</a>
<a href="./features">Read docs</a>
</div>

<div class="home-showcase">
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ hero:

<div class="hero-actions">
<a class="primary" href="https://github.com/Radiant303/SpringNote/releases/latest">下载最新版</a>
<a href="/features">阅读文档</a>
<a href="./features">阅读文档</a>
</div>

<div class="home-showcase">
Expand Down
Loading