doc(Metrics&Alert): 新增 API文档、数据库设计文档、新增接口实现 #42
This file contains hidden or 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 Frontend to Vercel | |
on: | |
pull_request_target: | |
branches: [develop] | |
paths: ['client/**'] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'yarn' | |
cache-dependency-path: client/yarn.lock | |
- name: Install dependencies | |
run: | | |
cd client | |
yarn install --frozen-lockfile | |
- name: Build project | |
run: | | |
cd client | |
yarn build | |
- name: Deploy to Vercel | |
id: vercel-deploy | |
uses: amondnet/vercel-action@v25 | |
with: | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} | |
working-directory: ./client | |
scope: ${{ secrets.VERCEL_ORG_ID }} | |
- name: Comment PR | |
if: github.event_name == 'pull_request_target' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const deployUrl = '${{ steps.vercel-deploy.outputs.preview-url }}'; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `🚀 **Frontend deployed successfully!**\n\n📱 **Preview URL:** ${deployUrl || 'Deployment in progress...'}\n\n✅ Build completed successfully` | |
}); |