Skip to content

Commit 89ca151

Browse files
committed
feat: add prerelease:local label
1 parent f875395 commit 89ca151

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/prerelease.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ permissions:
1414

1515
jobs:
1616
deploy:
17-
if: contains(github.event.pull_request.labels.*.name, 'prerelease')
1817
runs-on: ubuntu-latest
1918
strategy:
2019
matrix:
@@ -27,13 +26,27 @@ jobs:
2726
secret_project_id: VERCEL_PROJECT_ZH_HANT_ID
2827
name: Deploy ${{ matrix.locale }}
2928
steps:
29+
# Calculate if this matrix job should run based on PR labels
30+
- name: Calculate should_deploy
31+
id: should_deploy
32+
run: |
33+
if [[ "${{ github.event_name }}" != "pull_request" ]] || \
34+
[[ "${{ github.event.pull_request.labels.*.name }}" == *prerelease* ]] || \
35+
[[ "${{ github.event.pull_request.labels.*.name }}" == *prerelease:${{ matrix.locale }}* ]]; then
36+
echo "should_deploy=true" >> $GITHUB_OUTPUT
37+
else
38+
echo "should_deploy=false" >> $GITHUB_OUTPUT
39+
fi
3040
- name: Checkout code
41+
if: steps.should_deploy.outputs.should_deploy == 'true'
3142
uses: actions/checkout@v3
3243
with:
3344
fetch-depth: 1
3445
- name: Setup Tools
46+
if: steps.should_deploy.outputs.should_deploy == 'true'
3547
uses: ./.github/actions/setup
3648
- name: Deploy to Vercel (${{ matrix.locale }})
49+
if: steps.should_deploy.outputs.should_deploy == 'true'
3750
id: deploy
3851
uses: ./.github/actions/vercel-deploy
3952
with:
@@ -42,6 +55,7 @@ jobs:
4255
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
4356
vercel_token: ${{ secrets.VERCEL_TOKEN }}
4457
- name: Comment PR with Vercel Preview Links (${{ matrix.locale }})
58+
if: steps.should_deploy.outputs.should_deploy == 'true'
4559
uses: ./.github/actions/comment-vercel-preview
4660
with:
4761
inspect_url: ${{ steps.deploy.outputs.inspect_url }}

0 commit comments

Comments
 (0)