更新hooks包版本至0.0.2 #32
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: Deploy VitePress site to Pages | |
on: | |
push: | |
branches: [master] | |
# 权限设置 | |
permissions: | |
# 允许读取仓库内容的权限。 | |
contents: read | |
# 允许写入 GitHub Pages 的权限。 | |
pages: write | |
# 允许写入 id-token 的权限。 | |
id-token: write | |
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列 | |
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成 | |
concurrency: | |
group: pages | |
cancel-in-progress: false | |
jobs: | |
# 构建工作 | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 # 安装pnpm并添加到环境变量 | |
with: | |
version: 9.2.0 # 指定需要的 pnpm 版本 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: pnpm # 设置缓存 | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 # 在工作流程自动配置GithubPages | |
- name: Install dependencies | |
run: pnpm install # 安装依赖 | |
- name: Build with VitePress | |
run: | | |
pnpm run docs:build # 启动项目 | |
touch .nojekyll # 通知githubpages不要使用Jekyll处理这个站点,不知道为啥不生效,就手动搞了 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 # 上传构建产物 | |
with: | |
path: ./docs/.vitepress/dist # 指定上传的路径,当前是根目录,如果是docs需要加docs/的前缀 | |
# 部署工作 | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} # 从后续的输出中获取部署后的页面URL | |
needs: build # 在build后面完成 | |
runs-on: ubuntu-latest # 运行在最新版本的ubuntu系统上 | |
name: Deploy | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment # 指定id | |
uses: actions/deploy-pages@v2 # 将之前的构建产物部署到github pages中 |