Skip to content

Commit 351c6b7

Browse files
committed
Fix Vercel workflow secret gating
1 parent 1d5649f commit 351c6b7

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/vercel-production.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,53 @@ on:
88

99
jobs:
1010
deploy:
11-
if: ${{ secrets.VERCEL_TOKEN != '' && secrets.VERCEL_ORG_ID != '' && secrets.VERCEL_PROJECT_ID != '' }}
1211
runs-on: ubuntu-latest
1312
steps:
1413
- uses: actions/checkout@v4
14+
- name: Check Vercel configuration
15+
id: vercel-config
16+
env:
17+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
18+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
19+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
20+
run: |
21+
if [ -n "${VERCEL_TOKEN}" ] && [ -n "${VERCEL_ORG_ID}" ] && [ -n "${VERCEL_PROJECT_ID}" ]; then
22+
echo "configured=true" >> "$GITHUB_OUTPUT"
23+
else
24+
echo "configured=false" >> "$GITHUB_OUTPUT"
25+
fi
1526
- uses: actions/setup-node@v4
27+
if: steps.vercel-config.outputs.configured == 'true'
1628
with:
1729
node-version: "22"
1830
cache: "npm"
1931
cache-dependency-path: docs/web/package-lock.json
2032
- name: Install Vercel CLI
33+
if: steps.vercel-config.outputs.configured == 'true'
2134
run: npm install --global vercel@latest
2235
- name: Pull Vercel Environment
36+
if: steps.vercel-config.outputs.configured == 'true'
2337
working-directory: docs/web
2438
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
2539
env:
2640
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
2741
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
2842
- name: Build
43+
if: steps.vercel-config.outputs.configured == 'true'
2944
working-directory: docs/web
3045
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
3146
env:
3247
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
3348
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
3449
- name: Deploy
50+
if: steps.vercel-config.outputs.configured == 'true'
3551
working-directory: docs/web
3652
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
3753
env:
3854
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
3955
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
40-
41-
skip-without-secrets:
42-
if: ${{ secrets.VERCEL_TOKEN == '' || secrets.VERCEL_ORG_ID == '' || secrets.VERCEL_PROJECT_ID == '' }}
43-
runs-on: ubuntu-latest
44-
steps:
4556
- name: Skip deploy when Vercel secrets are missing
57+
if: steps.vercel-config.outputs.configured != 'true'
4658
run: |
4759
echo "Skipping Vercel production deploy because VERCEL_TOKEN, VERCEL_ORG_ID, or VERCEL_PROJECT_ID is not configured."
4860
echo "Configure those repository secrets to enable automatic production deployment."

0 commit comments

Comments
 (0)