-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (37 loc) · 1.22 KB
/
vercel-deploy-prev-from-branch.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Vercel - preview deployment on push to feature branch
on:
pull_request:
branches: [main]
workflow_dispatch:
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
jobs:
deploy-code:
permissions:
deployments: write
name: Deploy to Vercel - preview
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Deploy to Vercel - preview
run: |
vercel deploy --token=${{ secrets.VERCEL_TOKEN }} > deployment-url.txt
echo "DEPLOYMENT_URL=$(cat deployment-url.txt)" >> $GITHUB_ENV
- name: Create GitHub deployment
uses: chrnorm/deployment-action@v2
id: deployment
with:
token: "${{ github.token }}"
environment-url: ${{ env.DEPLOYMENT_URL}}
environment: preview
- name: Update GitHub deployment status
uses: chrnorm/deployment-status@v2
with:
token: "${{ github.token }}"
environment-url: ${{ env.DEPLOYMENT_URL}}
state: "success"
deployment-id: ${{ steps.deployment.outputs.deployment_id }}