测试 #5
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: CI | |
on: | |
push: | |
branches: | |
- '**' | |
jobs: | |
build: | |
name: Build and Deploy to Vercel | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
check-latest: true | |
- name: Cache pnpm modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.pnpm-store | |
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm- | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2.4.0 | |
with: | |
version: 8.7.5 # 可以根据需要调整为最新的稳定版本 | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile --strict-peer-dependencies | |
timeout-minutes: 10 | |
- name: Codegen | |
run: pnpm codegen | |
timeout-minutes: 5 | |
- name: Test | |
run: pnpm test | |
timeout-minutes: 15 | |
- name: Build | |
run: pnpm build | |
timeout-minutes: 15 | |
- 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: ./dist | |
github-comment: false | |
timeout-minutes: 5 | |
- 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: ./dist | |
github-comment: false | |
timeout-minutes: 5 |