Skip to content

Commit 72782dc

Browse files
committed
feat: enhance Vercel preview deployment workflow with environment URL extraction
1 parent 5984e95 commit 72782dc

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Diff for: .github/workflows/vercel-preview.yml

+17-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ name: Vercel Preview Deployment
22
env:
33
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
44
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
5+
56
on:
67
push:
78
branches-ignore:
89
- main
10+
911
jobs:
1012
Deploy-Preview:
1113
runs-on: ubuntu-20.04
14+
environment:
15+
name: preview
1216
steps:
1317
- uses: actions/checkout@v4
1418
- name: Install Vercel CLI
@@ -18,4 +22,16 @@ jobs:
1822
- name: Build Project Artifacts
1923
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
2024
- name: Deploy Project Artifacts to Vercel
21-
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
25+
run: |
26+
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > deployment.txt
27+
id: deploy
28+
- name: Extract Deployment URL
29+
run: |
30+
DEPLOYMENT_URL=$(tail -n 1 deployment.txt)
31+
echo "DEPLOYMENT_URL=$DEPLOYMENT_URL" >> $GITHUB_ENV
32+
id: extract-url
33+
- name: Set Environment URL
34+
if: success()
35+
environment:
36+
name: preview
37+
url: ${{ env.DEPLOYMENT_URL }}

0 commit comments

Comments
 (0)