wip: 🕔 修改配置 #24
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
# 这是一个用于将静态内容部署到 GitHub Pages 的简单工作流程。 | |
# 任务名称为“Deploy static content to Pages”。 | |
# 在以下事件触发时执行: | |
# - 推送到默认分支(branch)时 | |
# - 手动从 Actions 标签页运行 | |
# 设置 GITHUB_TOKEN 的权限,以允许将内容部署到 GitHub Pages 上。具体设置了 contents 和 pages 权限,同时还设置了 id-token 权限。 | |
# 并发设置:仅允许一个并发部署,并跳过在运行中的和最新排队的运行之间的运行,但不要取消正在进行的运行,因为我们希望这些生产部署能够完成。 | |
# 只有一个部署任务,因为我们只需要部署。 | |
# 部署任务的内容包括: | |
# - 环境变量:github-pages 名称和 ${{ steps.deployment.outputs.page_url }} URL | |
# - 运行环境:ubuntu-latest | |
# - 步骤: | |
# - 检出代码 | |
# - 设置 Node.js 环境 | |
# - 安装依赖 | |
# - 构建项目 | |
# - 设置 Pages | |
# - 上传文件 | |
# - 部署到 GitHub Pages | |
name: Deploy static content to Pages | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
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 | |
run: npm run build:pro | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "./dist" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |