Skip to content

测试

测试 #6

Workflow file for this run

name: CI
on:
push:
branches:
- '**'
jobs:
build:
name: Build and Deploy to Vercel
runs-on: ubuntu-latest
steps:
# 检出代码
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
# 设置 Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
# 安装 pnpm
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 8.7.5
# 安装依赖
- name: Install dependencies
run: pnpm install --frozen-lockfile --strict-peer-dependencies
# 生成代码
- name: Codegen
run: pnpm codegen
# 运行测试
- name: Run tests
run: pnpm test
# 构建项目
- name: Build project
run: pnpm build
# 部署到 Vercel(预发布环境)
- name: Deploy to Vercel (Staging)
if: ${{ github.ref != 'refs/heads/main' }}
uses: amondnet/vercel-action@v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
working-directory: ./
github-comment: false
# 部署到 Vercel(生产环境)
- name: Deploy to Vercel (Production)
if: ${{ github.ref == 'refs/heads/main' }}
uses: amondnet/vercel-action@v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
vercel-args: '--prod'
working-directory: ./
github-comment: false