|
8 | 8 | - labeled |
9 | 9 | - synchronize |
10 | 10 |
|
11 | | -jobs: |
12 | | - deploy-en: |
13 | | - if: contains(github.event.pull_request.labels.*.name, 'prerelease') |
14 | | - uses: ./.github/workflows/vercel-deploy.yml |
15 | | - with: |
16 | | - environment: preview |
17 | | - prodFlag: '' |
18 | | - secrets: |
19 | | - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_EN_ID }} |
20 | | - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} |
21 | | - VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} |
22 | | - |
23 | | - deploy-zh-hans: |
24 | | - if: contains(github.event.pull_request.labels.*.name, 'prerelease') |
25 | | - uses: ./.github/workflows/vercel-deploy.yml |
26 | | - with: |
27 | | - environment: preview |
28 | | - prodFlag: '' |
29 | | - secrets: |
30 | | - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ZH_HANS_ID }} |
31 | | - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} |
32 | | - VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} |
| 11 | +permissions: |
| 12 | + pull-requests: write |
| 13 | + issues: write |
33 | 14 |
|
34 | | - comment-vercel-preview: |
| 15 | +jobs: |
| 16 | + deploy: |
35 | 17 | if: contains(github.event.pull_request.labels.*.name, 'prerelease') |
36 | | - needs: [deploy-en, deploy-zh-hans] |
37 | 18 | runs-on: ubuntu-latest |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + include: |
| 22 | + - name: Deploy EN |
| 23 | + locale: EN |
| 24 | + secret_project_id: VERCEL_PROJECT_EN_ID |
| 25 | + - name: Deploy ZH-HANS |
| 26 | + locale: ZH-HANS |
| 27 | + secret_project_id: VERCEL_PROJECT_ZH_HANS_ID |
| 28 | + name: ${{ matrix.name }} |
38 | 29 | steps: |
39 | | - - name: Comment PR with Vercel Preview Links |
40 | | - uses: actions/github-script@v7 |
| 30 | + - name: Checkout code |
| 31 | + uses: actions/checkout@v3 |
| 32 | + with: |
| 33 | + fetch-depth: 1 |
| 34 | + - name: Setup Tools |
| 35 | + uses: ./.github/actions/setup |
| 36 | + - name: Deploy to Vercel (${{ matrix.locale }}) |
| 37 | + id: deploy |
| 38 | + uses: ./.github/actions/vercel-deploy |
| 39 | + with: |
| 40 | + environment: preview |
| 41 | + prodFlag: "" |
| 42 | + vercel_project_id: ${{ secrets[matrix.secret_project_id] }} |
| 43 | + vercel_org_id: ${{ secrets.VERCEL_ORG_ID }} |
| 44 | + vercel_token: ${{ secrets.VERCEL_TOKEN }} |
| 45 | + - name: Comment PR with Vercel Preview Links (${{ matrix.locale }}) |
| 46 | + uses: ./.github/actions/comment-vercel-preview |
41 | 47 | with: |
42 | | - script: | |
43 | | - const en_inspect = process.env.EN_INSPECT_URL; |
44 | | - const en_prod = process.env.EN_PROD_URL; |
45 | | - const zh_inspect = process.env.ZH_INSPECT_URL; |
46 | | - const zh_prod = process.env.ZH_PROD_URL; |
47 | | - let body = `**Vercel Deploy Preview**\n\n`; |
48 | | - body += `- 🇺🇸 EN: [Inspect](${en_inspect}) | [Preview](${en_prod})\n`; |
49 | | - body += `- 🇨🇳 ZH-HANS: [Inspect](${zh_inspect}) | [Preview](${zh_prod})`; |
50 | | - github.rest.issues.createComment({ |
51 | | - issue_number: context.issue.number, |
52 | | - owner: context.repo.owner, |
53 | | - repo: context.repo.repo, |
54 | | - body |
55 | | - }); |
56 | | - env: |
57 | | - EN_INSPECT_URL: ${{ needs.deploy-en.outputs.inspect_url }} |
58 | | - EN_PROD_URL: ${{ needs.deploy-en.outputs.prod_url }} |
59 | | - ZH_INSPECT_URL: ${{ needs.deploy-zh-hans.outputs.inspect_url }} |
60 | | - ZH_PROD_URL: ${{ needs.deploy-zh-hans.outputs.prod_url }} |
| 48 | + inspect_url: ${{ steps.deploy.outputs.inspect_url }} |
| 49 | + preview_url: ${{ steps.deploy.outputs.prod_url }} |
| 50 | + label: ${{ matrix.locale }} |
0 commit comments