Skip to content

Commit

Permalink
feat: build for develop
Browse files Browse the repository at this point in the history
  • Loading branch information
lukicenturi authored and kelsos committed Oct 4, 2024
1 parent 9aa1e69 commit e5d2e4a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
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*',
},
});

0 comments on commit e5d2e4a

Please sign in to comment.