Some checks failed
Deploy to GitHub Pages / build (push) Failing after 5m16s
Deploy to GitHub Pages / deploy (push) Has been skipped
62 lines
1.3 KiB
YAML
62 lines
1.3 KiB
YAML
name: Deploy to GitHub Pages
|
|
|
|
on:
|
|
# 当推送到main分支时触发
|
|
push:
|
|
branches: [ main, master ]
|
|
|
|
# 允许手动触发工作流
|
|
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
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build for GitHub Pages
|
|
run: npm run build:github
|
|
|
|
- name: Setup Pages
|
|
uses: actions/configure-pages@v4
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
# 上传dist目录
|
|
path: ./dist
|
|
|
|
# 部署作业
|
|
deploy:
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|