guide、news 已实现各站点同步更新,希望 https://typst.dev/tutorial/ (vercel) 和 https://tutorial.typst.dev/ (cloudflare) 也能与 https://typst-doc-cn.github.io/tutorial/ (github pages) 同步。
目前 vercel 和 cloudflare 从 https://github.com/Naptie/typst-doc-cn-tutorial 部署,不定期手动更新,已落后于 github pages。这导致 typst-doc-cn/guide#169 难以从 guide 链接到 tutorial。
实现要点
让 vercel 和 cloudflare 也从这个仓库部署。(之前 guide 也考虑过其它方案,最后发现都从一个仓库部署比较好。)
guide、news 已实现各站点同步更新,希望 https://typst.dev/tutorial/ (vercel) 和 https://tutorial.typst.dev/ (cloudflare) 也能与 https://typst-doc-cn.github.io/tutorial/ (github pages) 同步。
目前 vercel 和 cloudflare 从 https://github.com/Naptie/typst-doc-cn-tutorial 部署,不定期手动更新,已落后于 github pages。这导致 typst-doc-cn/guide#169 难以从 guide 链接到 tutorial。
实现要点
让 vercel 和 cloudflare 也从这个仓库部署。(之前 guide 也考虑过其它方案,最后发现都从一个仓库部署比较好。)
按部署方式选择base
这点比较简单,设置
--path-to-root /或--path-to-root /tutorial/就行。按部署方式切换跨站链接
比如源代码里写的 https://typst-doc-cn.github.io/guide/ ,部署到 vercel 时应转换成 https://typst.dev/guide/ 。
如果 shiroa 不存在兼容问题,那这点也不难,基本只需要
show link: it => html.a(href: transform(it.text), it.body),具体参考以下 news 的mirror-link.typ。https://github.com/typst-doc-cn/news/blob/main/typ/packages/mirror-link.typ
https://github.com/typst-doc-cn/guide/blob/master/docs/.vitepress/plugins/mirror_link.ts
实现该功能需要 feat(cli): --input KEY=VALUE passthrough to sys.inputs Myriad-Dreamin/shiroa#240 ,得等 shiroa 发新版。
迁移 vercel、cloudflare 到此仓库
把以上两点集成到
.github/workflows/,然后联系 https://github.com/Naptie 在此仓库设置 secrets。可参考 https://github.com/Naptie/ 的修改内容和 news、guide 的经验。main...Naptie:typst-doc-cn-tutorial:main
https://github.com/typst-doc-cn/news/blob/main/.github/workflows/deploy.yaml
https://github.com/typst-doc-cn/guide/blob/master/.github/workflows/build.yml