ci: fix github pages publishing
This commit is contained in:
@@ -2,9 +2,10 @@ name: Deploy Docs
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main, develop]
|
||||||
paths:
|
paths:
|
||||||
- 'website/**'
|
- ".github/workflows/deploy-docs.yml"
|
||||||
|
- "website/**"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -13,27 +14,36 @@ permissions:
|
|||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: pages
|
group: pages-${{ github.ref }}
|
||||||
cancel-in-progress: false
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Configure GitHub Pages
|
||||||
|
id: pages
|
||||||
|
uses: actions/configure-pages@v5
|
||||||
|
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version: 1.1.38
|
bun-version: 1.1.38
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
working-directory: website
|
working-directory: website
|
||||||
run: bun install
|
run: bun install --frozen-lockfile
|
||||||
|
|
||||||
- name: Build docs
|
- name: Build docs
|
||||||
working-directory: website
|
working-directory: website
|
||||||
|
env:
|
||||||
|
DOCS_BASE: ${{ steps.pages.outputs.base_path }}
|
||||||
|
DOCS_EDIT_BRANCH: ${{ github.ref_name }}
|
||||||
run: bun run docs:build
|
run: bun run docs:build
|
||||||
|
|
||||||
- uses: actions/upload-pages-artifact@v3
|
- uses: actions/upload-pages-artifact@v3
|
||||||
@@ -41,11 +51,15 @@ jobs:
|
|||||||
path: website/.vitepress/dist
|
path: website/.vitepress/dist
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
|
if: github.ref_name == 'main' || github.ref_name == 'develop'
|
||||||
environment:
|
environment:
|
||||||
name: github-pages
|
name: github-pages
|
||||||
url: ${{ steps.deployment.outputs.page_url }}
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
[build]
|
|
||||||
base = "website"
|
|
||||||
command = "bun run docs:build"
|
|
||||||
publish = ".vitepress/dist"
|
|
||||||
|
|
||||||
[build.environment]
|
|
||||||
DOCS_BASE = "/"
|
|
||||||
@@ -1,7 +1,16 @@
|
|||||||
import { defineConfig } from 'vitepress'
|
import { defineConfig } from 'vitepress'
|
||||||
import { withMermaid } from 'vitepress-plugin-mermaid'
|
import { withMermaid } from 'vitepress-plugin-mermaid'
|
||||||
|
|
||||||
const docsBase = process.env.DOCS_BASE || '/mempalace/'
|
function normalizeBase(base?: string): string {
|
||||||
|
if (!base || base === '/') {
|
||||||
|
return '/'
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.endsWith('/') ? base : `${base}/`
|
||||||
|
}
|
||||||
|
|
||||||
|
const docsBase = normalizeBase(process.env.DOCS_BASE || '/mempalace/')
|
||||||
|
const editBranch = process.env.DOCS_EDIT_BRANCH || 'main'
|
||||||
|
|
||||||
export default withMermaid(
|
export default withMermaid(
|
||||||
defineConfig({
|
defineConfig({
|
||||||
@@ -91,7 +100,7 @@ export default withMermaid(
|
|||||||
},
|
},
|
||||||
|
|
||||||
editLink: {
|
editLink: {
|
||||||
pattern: 'https://github.com/milla-jovovich/mempalace/edit/main/website/:path',
|
pattern: `https://github.com/milla-jovovich/mempalace/edit/${editBranch}/website/:path`,
|
||||||
text: 'Edit this page on GitHub',
|
text: 'Edit this page on GitHub',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user