-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (40 loc) · 1.35 KB
/
deploy.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
38
39
40
41
name: Vercel Deploy
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
id: extract_branch
run: |
branch_name=${GITHUB_REF#refs/heads/}
branch_formatted=${branch_name//\//-}
echo $branch_name
echo $branch_formatted
echo ::set-output name=branch::$branch_formatted
- name: Checkout Code
uses: actions/checkout@v2
- name: Deploy to Staging
id: deploy-vercel-staging
uses: amondnet/vercel-action@v20
if: github.ref != 'refs/heads/main'
with:
vercel-token: ${{secrets.VERCEL_TOKEN}}
github-token: ${{secrets.VERCEL_GITHUB_TOKEN}}
vercel-org-id: ${{secrets.VERCEL_ORG_ID}}
vercel-project-id: ${{secrets.VERCEL_PROJECT_ID}}
alias-domains: >-
${{ format(
'{0}-{1}.vercel.app',
secrets.VERCEL_DOMAIN,
steps.extract_branch.outputs.branch)
}}
- name: Deploy to Production
id: deploy-vercel-production
uses: amondnet/vercel-action@v20
if: github.ref == 'refs/heads/main'
with:
vercel-token: ${{secrets.VERCEL_TOKEN}}
vercel-org-id: ${{secrets.VERCEL_ORG_ID}}
vercel-project-id: ${{secrets.VERCEL_PROJECT_ID}}
vercel-args: "--prod"