Skip to content

Commit a8c9e9e

Browse files
committed
deploy to github pages
1 parent fc95a89 commit a8c9e9e

File tree

2 files changed

+56
-4
lines changed

2 files changed

+56
-4
lines changed

.github/workflows/docs.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: read
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 20
18+
cache: npm
19+
- uses: actions/configure-pages@v3
20+
id: pages
21+
- name: Install dependencies
22+
run: npm install
23+
- name: Build
24+
env:
25+
GITHUB_PAGES_BASE: "${{ steps.pages.outputs.base_url }}"
26+
run: npm run docs:build
27+
- name: Upload artifact
28+
uses: actions/upload-pages-artifact@v3
29+
with:
30+
path: .vuepress/dist/
31+
32+
deploy:
33+
if: github.ref == 'refs/heads/master'
34+
needs: build
35+
permissions:
36+
pages: write
37+
id-token: write
38+
environment:
39+
name: github-pages
40+
url: ${{ steps.deployment.outputs.page_url }}
41+
runs-on: ubuntu-latest
42+
concurrency:
43+
group: deploy
44+
cancel-in-progress: true
45+
steps:
46+
- name: Deploy to GitHub Pages
47+
id: deployment
48+
uses: actions/deploy-pages@v4

.vuepress/config.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { viteBundler } from '@vuepress/bundler-vite'
22
import { defaultTheme } from '@vuepress/theme-default'
33
import { defineUserConfig } from 'vuepress'
4+
import { env } from 'node:process';
45

5-
export default defineUserConfig({
6+
const options = {
67
title: "MetaCPAN infra",
78
description: "MetaCPAN infrastructure and networking",
89
bundler: viteBundler(),
@@ -32,7 +33,10 @@ export default defineUserConfig({
3233
// }
3334
// ]
3435
]
35-
})
36-
37-
export {
3836
};
37+
38+
if (env.GITHUB_PAGES_BASE) {
39+
options.base = env.GITHUB_PAGES_BASE.replace(/^\/?/, '/').replace(/\/?$/, '/');
40+
}
41+
42+
export default defineUserConfig(options);

0 commit comments

Comments
 (0)