Skip to content

Commit c0105ea

Browse files
Prepare deploy gh action
1 parent 743cad8 commit c0105ea

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

.github/workflows/deploy.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,31 @@ jobs:
77
build-and-deploy:
88
runs-on: ubuntu-latest
99
steps:
10-
- name: Checkout 🛎️
11-
uses: actions/checkout@v3
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Install pandoc
14+
uses: pandoc/actions/setup@v1
15+
with:
16+
version: 3.5
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
cache: npm
23+
24+
- name: Build md files
25+
run: npm run pandoc:build
1226

1327
- name: Install dependencies
14-
run: |
15-
sudo apt-get install -y python3-sphinx python3-sphinx-rtd-theme
28+
run: npm ci
1629

17-
- name: Build
18-
run: |
19-
cd docs && make html
30+
- name: Build with VitePress
31+
run: npm run docs:build
2032

2133
- name: Deploy
2234
uses: JamesIves/github-pages-deploy-action@v4.3.3
2335
with:
2436
branch: gh-pages
25-
folder: docs/_build/html
37+
folder: .vitepress/dist

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"test": "echo \"Error: no test specified\" && exit 1",
77
"docs:dev": "vitepress dev",
88
"docs:build": "vitepress build",
9-
"docs:preview": "vitepress preview"
9+
"docs:preview": "vitepress preview",
10+
"pandoc:build": "node ./scripts/generate_md.mjs"
1011
},
1112
"repository": {
1213
"type": "git",

scripts/generate_md.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import { fileURLToPath } from 'node:url';
77
const __dirname = dirname(fileURLToPath(import.meta.url));
88

99
const generateMd = async () => {
10-
const files = fs.readdirSync(path.resolve(__dirname, '../docs'))
11-
fs.mkdirSync(path.resolve(__dirname, '../docs_md'))
10+
const files = await fs.promises.readdir(path.resolve(__dirname, '../docs'))
11+
await fs.promises.rm(path.resolve(__dirname, '../docs_md'), { recursive: true, force: true })
12+
fs.promises.mkdir(path.resolve(__dirname, '../docs_md'))
1213
for await (const file of files) {
1314
execSync(`pandoc --lua-filter=${__dirname}/pandoc_fix_links.lua -s ${__dirname}/../docs/${file} -o ${__dirname}/../docs_md/${path.parse(file).name}.md -t gfm`)
1415
}

0 commit comments

Comments
 (0)