Skip to content

Commit f6178a9

Browse files
committed
update aliyun 1000-hours deplopyment
1 parent 295d971 commit f6178a9

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

.github/workflows/deploy-1000h-aliyun.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,20 @@ jobs:
3535
- name: Install dependencies
3636
run: yarn install
3737

38-
- name: Set Base Path
39-
run: sed -i 's/defineConfig({/defineConfig({"base":"\/1000-hours\/",/g' 1000-hours/.vitepress/config.mts
38+
- name: Write Aliyun OSS Config
39+
run: |
40+
cat <<EOL > 1000-hours/.vitepress/config.aliyun.js
41+
// Aliyun OSS 配置
42+
export default {
43+
base: "/1000-hours/",
44+
transformHtml: (code, id, html) => {
45+
// 使用正则匹配 <span data-audio-*> 并替换路径
46+
return html.content.replace(/(<span[^>]*\s)data-audio-([\w-]+)="\/audios\/(.*?)"/g, (match, before, key, value) => {
47+
return `${before}data-audio-${key}="/1000-hours/audios/${value}"`
48+
})
49+
}
50+
}
51+
EOL
4052
4153
- name: Build
4254
run: yarn docs:build

0 commit comments

Comments
 (0)