docs: 添加 tutorials 教程 #1
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
# 部署 docs pages 到 GitHub 页面 | |
name: deploy-docs | |
on: | |
# 通过推送或拉取主分支(main)事件触发工作流 | |
push: | |
branches: | |
- main | |
# 这将启用“操作”选项卡上的“运行工作流”按钮 | |
workflow_dispatch: | |
# 设置 GITHUB_TOKEN 的权限,允许部署到 GitHub 页面 | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# 只允许一个并发部署,跳过正在运行和最新队列之间的运行队列, | |
# 但是, 不要取消正在进行的 action, 因为我们希望允许这些生产部署完成 | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
# 部署作业,因为我们只是在部署 | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# 指定了操作系统为‘ubuntu-latest’ | |
runs-on: ubuntu-latest | |
# Steps 代表一系列任务作为作业的一部分而被执行 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: npm | |
- name: Install dependencies | |
run: npm install | |
- name: Build Docs | |
run: npm run docs | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
# 上传 page 的路径 | |
path: './docs/src' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |