Skip to content

Commit 1feb868

Browse files
Harden Vercel deployment with credential validation
1 parent eca9907 commit 1feb868

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,38 @@ jobs:
6767
needs: typecheck
6868
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
6969
runs-on: ubuntu-latest
70+
env:
71+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
72+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
73+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
7074

7175
steps:
7276
- uses: actions/checkout@v5
7377
- uses: actions/setup-node@v5
7478
with:
7579
node-version: "24"
7680
- name: Install Vercel CLI
77-
run: npm install -g vercel
78-
- name: Deploy
81+
run: npm install --global vercel@59.1.3
82+
- name: Validate Vercel credentials
83+
run: |
84+
if [[ -z "$VERCEL_TOKEN" ]]; then
85+
echo "::error::The VERCEL_TOKEN GitHub Actions secret is missing."
86+
exit 1
87+
fi
88+
if [[ -z "$VERCEL_ORG_ID" ]]; then
89+
echo "::error::The VERCEL_ORG_ID GitHub Actions secret is missing."
90+
exit 1
91+
fi
92+
if [[ -z "$VERCEL_PROJECT_ID" ]]; then
93+
echo "::error::The VERCEL_PROJECT_ID GitHub Actions secret is missing."
94+
exit 1
95+
fi
96+
- name: Pull Vercel production configuration
97+
working-directory: ./frontend
98+
run: vercel pull --yes --environment=production --token="$VERCEL_TOKEN"
99+
- name: Build Vercel artifacts
100+
working-directory: ./frontend
101+
run: vercel build --prod --token="$VERCEL_TOKEN"
102+
- name: Deploy Vercel artifacts
79103
working-directory: ./frontend
80-
run: vercel --prod --yes --token=${{ secrets.VERCEL_TOKEN }}
81-
env:
82-
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
83-
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
104+
run: vercel deploy --prebuilt --prod --token="$VERCEL_TOKEN"

0 commit comments

Comments
 (0)