Loading...
Loading...
Compare original and translation side by side
references/platform-comparison.mdreferences/platform-comparison.mdnpm cinpm ciundefinedundefinedundefinedundefinedNODE_ENVproductionNODE_ENVproductionassets/assets/github-actions-nodejs.ymlassets/gitlab-ci-nodejs.yml.github/workflows/ci.yml.gitlab-ci.ymlassets/assets/github-actions-nodejs.ymlassets/gitlab-ci-nodejs.yml.github/workflows/ci.yml.gitlab-ci.yml- 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 }}
vercel-args: '--prod'VERCEL_TOKENVERCEL_ORG_IDVERCEL_PROJECT_ID- 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 }}
vercel-args: '--prod'VERCEL_TOKENVERCEL_ORG_IDVERCEL_PROJECT_ID- run: |
npm install -g netlify-cli
netlify deploy --prod --dir=.next
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}- run: |
npm install -g netlify-cli
netlify deploy --prod --dir=.next
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- run: |
aws s3 sync .next/static s3://${{ secrets.S3_BUCKET }}/static
aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_DIST_ID }} --paths "/*"- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- run: |
aws s3 sync .next/static s3://${{ secrets.S3_BUCKET }}/static
aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_DIST_ID }} --paths "/*"- name: Run tests with coverage
run: npm test -- --coverage --coverageReporters=text --coverageReporters=lcov
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: ./coverage/lcov.info
flags: unittestsundefined- name: 运行带覆盖率的测试
run: npm test -- --coverage --coverageReporters=text --coverageReporters=lcov
- name: 上传覆盖率数据
uses: codecov/codecov-action@v4
with:
files: ./coverage/lcov.info
flags: unittestsundefinedundefinedundefineddeploy_staging:
if: github.ref == 'refs/heads/develop'
# Deploy to staging
deploy_production:
if: github.ref == 'refs/heads/main'
environment: production # Requires manual approval
# Deploy to productiondeploy_staging:
if: github.ref == 'refs/heads/develop'
# 部署到预发布环境
deploy_production:
if: github.ref == 'refs/heads/main'
environment: production # 需要手动审批
# 部署到生产环境assets/github-actions-nodejs.ymlassets/gitlab-ci-nodejs.ymlreferences/platform-comparison.mdassets/github-actions-nodejs.ymlassets/gitlab-ci-nodejs.ymlreferences/platform-comparison.md******18.x18package-lock.jsoncontinue-on-error18.x18package-lock.jsoncontinue-on-errordeploy_staging:
environment: staging
if: github.ref == 'refs/heads/develop'
deploy_production:
environment: production
if: github.ref == 'refs/heads/main'
needs: [deploy_staging]deploy_staging:
environment: staging
if: github.ref == 'refs/heads/develop'
deploy_production:
environment: production
if: github.ref == 'refs/heads/main'
needs: [deploy_staging]strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
os: [ubuntu-latest, windows-latest]strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
os: [ubuntu-latest, windows-latest]- name: Deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: npm run deploy- name: 部署
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: npm run deploy- name: Upload build
uses: actions/upload-artifact@v4
with:
name: build-output
path: .next/
retention-days: 7
- name: Download build
uses: actions/download-artifact@v4
with:
name: build-output- name: 上传构建产物
uses: actions/upload-artifact@v4
with:
name: build-output
path: .next/
retention-days: 7
- name: 下载构建产物
uses: actions/download-artifact@v4
with:
name: build-outputassets/assets/github-actions-nodejs.ymlgitlab-ci-nodejs.ymlgithub-actions-nodejs.ymlgitlab-ci-nodejs.ymlreferences/references/platform-comparison.mdplatform-comparison.mdassets/github-actions-nodejs.yml.github/workflows/.github/workflows/ci.ymlVERCEL_TOKENVERCEL_ORG_IDVERCEL_PROJECT_IDassets/gitlab-ci-nodejs.yml.gitlab-ci.ymlVERCEL_TOKENassets/github-actions-nodejs.yml.github/workflows/.github/workflows/ci.ymlVERCEL_TOKENVERCEL_ORG_IDVERCEL_PROJECT_IDassets/gitlab-ci-nodejs.yml.gitlab-ci.ymlVERCEL_TOKENpaths:
- 'apps/frontend/**'
- 'packages/**'paths:
- 'apps/frontend/**'
- 'packages/**'on:
schedule:
- cron: '0 2 * * *' # Daily at 2 AMon:
schedule:
- cron: '0 2 * * *' # 每天凌晨2点运行- name: Notify Slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
webhook_url: ${{ secrets.SLACK_WEBHOOK }}- name: 通知Slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
webhook_url: ${{ secrets.SLACK_WEBHOOK }}- name: Run security audit
run: npm audit --audit-level=moderate
- name: Check for vulnerabilities
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}- name: 运行安全审计
run: npm audit --audit-level=moderate
- name: 检查漏洞
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}