Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: multi-build #23

Merged
merged 1 commit into from
Oct 4, 2024
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
26 changes: 23 additions & 3 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ on:
push:
branches:
- main
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand All @@ -15,6 +16,8 @@ jobs:
steps:
- name: Checkout 🛎
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches

- name: Setup pnpm
uses: pnpm/action-setup@v4
Expand All @@ -28,8 +31,25 @@ jobs:
- name: Install dependencies 👨🏻‍💻
run: pnpm install --frozen-lockfile

- name: Build static
run: pnpm run build
- name: Build main (default) docs
run: |
git checkout main
pnpm run build
mv .vitepress/dist .vitepress/dist-main
env:
DOCS_VERSION: stable

- name: Build develop (latest) docs
run: |
git checkout develop
pnpm run build --outDir .vitepress/dist/latest
env:
DOCS_VERSION: latest

- name: Combine builds
run: |
mv .vitepress/dist-main/* .vitepress/dist/
rm -rf .vitepress/dist-main

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
Expand Down
24 changes: 24 additions & 0 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import path from 'node:path';
import process from 'node:process';
import { URL, fileURLToPath } from 'node:url';
import { defineConfig } from 'vitepress';
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs';

const __dirname = path.dirname(fileURLToPath(new URL(import.meta.url)));

const isLatest = process.env.DOCS_VERSION === 'latest';
const base = isLatest ? '/latest' : '/';

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: 'Rotki Documentation',
base,
description: 'All you need to start using rotki, or contributing to it.',
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
Expand All @@ -16,6 +21,22 @@ export default defineConfig({
{ text: 'Home', link: '/' },
{ text: 'Documentation', link: '/requirement-and-installation' },
{ text: 'Download', link: 'https://rotki.com/download' },
{
text: isLatest ? 'Latest' : 'Stable',
items: [
isLatest
? {
text: 'Stable',
link: 'https://docs.rotki.com/',
target: '_blank',
}
: {
text: 'Latest',
link: 'https://docs.rotki.com/latest/',
target: '_blank',
},
],
},
],

sidebar: [
Expand Down Expand Up @@ -108,4 +129,7 @@ export default defineConfig({
},
},
srcExclude: ['**/README.md', '**/LICENSE.md'],
rewrites: {
'latest/:path*': ':path*',
},
});