update ci #13
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 Nuxt3 App site to Pages by action | |
on: | |
# 在针对 `main` 分支的推送上运行。如果你 | |
# 使用 `master` 分支作为默认分支,请将其更改为 `master` | |
push: | |
branches: [main] | |
# 允许你从 Actions 选项卡手动运行此工作流程 | |
workflow_dispatch: | |
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列 | |
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成 | |
concurrency: | |
group: pages | |
cancel-in-progress: false | |
jobs: | |
# 构建工作 | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' # 使用适合的 Node.js 版本 | |
- name: Enable pnpm | |
run: corepack enable | |
- name: Install Dependencies | |
run: pnpm install # 或 yarn install,根据你的偏好选择 | |
- name: Generate Static Site | |
run: pnpm generate # 或者其他生成静态站点的命令,具体取决于你的 Nuxt.js 配置 # 或 pnpm docs:build / yarn docs:build / bun run docs:build | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: .output/public | |
# 部署工作 | |
deploy: | |
environment: # 部署环境 | |
name: github-pages # 部署到 GitHub Pages | |
url: ${{ steps.deployment.outputs.page_url }} # 部署后的 URL | |
needs: build # 郈接到构建工作 | |
runs-on: ubuntu-latest # 运行环境 | |
name: Deploy # 工作名称 | |
steps: # 步骤 | |
- name: Deploy to GitHub Pages # 部署到 GitHub Pages | |
id: deployment # 步骤 ID | |
uses: actions/deploy-pages@v4 # 使用的 action |