Skip to content

Commit 413757e

Browse files
committed
feat: add prerelease action
1 parent 6bdc53f commit 413757e

File tree

2 files changed

+46
-20
lines changed

2 files changed

+46
-20
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy Locale
2+
3+
description: >
4+
Composite action to deploy a specific locale to Vercel and comment the preview link on a PR.
5+
6+
inputs:
7+
locale:
8+
description: 'The locale to deploy (e.g., en, zh-hans, zh-hant)'
9+
required: true
10+
vercel_project_id:
11+
description: 'The Vercel project secret id for this locale'
12+
required: true
13+
vercel_org_id:
14+
description: 'The Vercel org id secret'
15+
required: true
16+
vercel_token:
17+
description: 'The Vercel token secret'
18+
required: true
19+
20+
runs:
21+
using: 'composite'
22+
steps:
23+
- name: Setup Tools
24+
uses: ./.github/actions/setup
25+
- name: Deploy to Vercel
26+
id: deploy
27+
uses: ./.github/actions/vercel-deploy
28+
with:
29+
environment: preview
30+
vercel_project_id: ${{ inputs.vercel_project_id }}
31+
vercel_org_id: ${{ inputs.vercel_org_id }}
32+
vercel_token: ${{ inputs.vercel_token }}
33+
- name: Comment PR with Vercel Preview Links
34+
uses: ./.github/actions/comment-vercel-preview
35+
with:
36+
inspect_url: ${{ steps.deploy.outputs.inspect_url }}
37+
preview_url: ${{ steps.deploy.outputs.prod_url }}
38+
label: ${{ inputs.locale }}

.github/workflows/prerelease.yml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ jobs:
1919
matrix:
2020
include:
2121
- locale: en
22-
secret_project_id: VERCEL_PROJECT_EN_ID
22+
vercel_project_id_key: VERCEL_PROJECT_EN_ID
2323
- locale: zh-hans
24-
secret_project_id: VERCEL_PROJECT_ZH_HANS_ID
24+
vercel_project_id_key: VERCEL_PROJECT_ZH_HANS_ID
2525
- locale: zh-hant
26-
secret_project_id: VERCEL_PROJECT_ZH_HANT_ID
26+
vercel_project_id_key: VERCEL_PROJECT_ZH_HANT_ID
27+
# Add more locales here as needed
2728
name: Deploy ${{ matrix.locale }}
2829
steps:
29-
# Calculate if this matrix job should run based on PR labels
3030
- name: Calculate should_deploy
3131
id: should_deploy
3232
shell: bash
@@ -48,24 +48,12 @@ jobs:
4848
run: |
4949
echo "Skipping deploy for ${{ matrix.locale }} due to missing label."
5050
exit 78
51-
5251
- name: Checkout code
5352
uses: actions/checkout@v3
5453
with:
5554
fetch-depth: 1
56-
- name: Setup Tools
57-
uses: ./.github/actions/setup
58-
- name: Deploy to Vercel (${{ matrix.locale }})
59-
id: deploy
60-
uses: ./.github/actions/vercel-deploy
61-
with:
62-
environment: preview
63-
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
64-
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
65-
vercel_token: ${{ secrets.VERCEL_TOKEN }}
66-
- name: Comment PR with Vercel Preview Links (${{ matrix.locale }})
67-
uses: ./.github/actions/comment-vercel-preview
55+
- name: Deploy ${{ matrix.locale }}
56+
uses: ./.github/actions/prerelease
6857
with:
69-
inspect_url: ${{ steps.deploy.outputs.inspect_url }}
70-
preview_url: ${{ steps.deploy.outputs.prod_url }}
71-
label: ${{ matrix.locale }}
58+
locale: ${{ matrix.locale }}
59+
vercel_project_id: ${{ secrets[matrix.vercel_project_id_key] }}

0 commit comments

Comments
 (0)