From 78865640c267215b013c4cfdac5b8cc2b1ded084 Mon Sep 17 00:00:00 2001 From: lukicenturi Date: Fri, 11 Oct 2024 18:55:16 +0700 Subject: [PATCH] chore: update CI to deploy bugfixes --- .github/workflows/deploy-docs.yml | 8 ++++++++ .vitepress/config.mts | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 67ee758..21facab 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -5,6 +5,7 @@ on: branches: - main - develop + - bugfixes concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -46,6 +47,13 @@ jobs: env: DOCS_VERSION: latest + - name: Build bugfixes (patch) docs + run: | + git checkout bugfixes + pnpm run build --outDir .vitepress/dist/patch + env: + DOCS_VERSION: patch + - name: Combine builds run: | mv .vitepress/dist-main/* .vitepress/dist/ diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 81f47bd..3de7e3e 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -6,8 +6,10 @@ 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' : '/'; +const DOCS_VERSION = process.env.DOCS_VERSION; +const isLatest = DOCS_VERSION === 'latest'; +const isPatch = DOCS_VERSION === 'patch'; +const base = isLatest || isPatch ? `/${DOCS_VERSION}` : '/'; // https://vitepress.dev/reference/site-config export default defineConfig({ @@ -131,5 +133,6 @@ export default defineConfig({ srcExclude: ['**/README.md', '**/LICENSE.md'], rewrites: { 'latest/:path*': ':path*', + 'patch/:path*': ':path*', }, });