docs: add and update posts #361
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: docs build | |
on: | |
push: | |
branches: | |
# 确保这是你正在使用的分支名称 | |
- main | |
jobs: | |
LearnData-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
# 获取所有标记和分支的所有历史记录(updatetime 必须,否则每次都会变化) | |
fetch-depth: 0 | |
# 如果你文档需要 Git 子模块,取消注释下一行 | |
# submodules: true | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
run_install: true | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: pnpm | |
# 将读书笔记复制到静态页路径,然后构建页面 | |
- name: Build Docs | |
env: | |
NODE_OPTIONS: --max_old_space_size=8192 | |
run: |- | |
pnpm cpx "docs/reading/**" docs/.vuepress/public/reading | |
pnpm run docs:build | |
> docs/.vuepress/dist/.nojekyll | |
- name: Deploy GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
# 这是文档部署到的分支名称 | |
branch: gh-pages | |
folder: docs/.vuepress/dist | |
### 没有服务器的话,请删除本区块代码,防止报错 ### | |
# 将页面推送到服务器,timeout 时间从默认的 1 分钟调整到 10 分钟。 | |
- name: 📂 Sync files | |
uses: SamKirkland/[email protected] | |
with: | |
local-dir: docs/.vuepress/dist/ | |
server: ${{ secrets.ftp_host }} | |
username: ${{ secrets.ftp_username }} | |
password: ${{ secrets.ftp_password }} | |
port: ${{ secrets.ftp_port }} # 建议更改默认的 21 端口 | |
timeout: 600000 | |
### 没有服务器的话,请删除本区块代码,防止报错 ### |