-
-
Notifications
You must be signed in to change notification settings - Fork 5
97 lines (89 loc) · 3.81 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: 🚀 Deploy to Vercel
on:
push:
branches:
- main
- demo
- '**'
workflow_dispatch:
inputs:
branch:
description: "Which branch do you want to deploy from?"
required: false
default: ""
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Determine branch
id: determine_branch
run: |
# If this workflow is triggered manually AND a branch input is provided,
# use that. Otherwise, fall back to the automatically provided ref_name.
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ inputs.branch }}" != "" ]; then
echo "branchName=${{ inputs.branch }}" >> $GITHUB_OUTPUT
else
echo "branchName=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Check out code
uses: actions/checkout@v3
with:
# Check out the branch from the previous step.
ref: ${{ steps.determine_branch.outputs.branchName }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 22
- name: Install dependencies
run: npm install --legacy-peer-deps
# Build step for demo branch
- name: Build for Vercel (demo)
if: ${{ steps.determine_branch.outputs.branchName == 'demo' }}
env:
SUPABASE_ANON_KEY: ${{ secrets.DEPLOY_DEMO_SUPABASE_ANON_KEY }}
SUPABASE_URL: ${{ secrets.DEPLOY_DEMO_SUPABASE_URL }}
DL_SUPABASE_PROJECT: ${{ secrets.DEPLOY_DEMO_DL_SUPABASE_PROJECT }}
DL_DNSDUMP_URL: ${{ secrets.DEPLOY_PROD_DL_DNSDUMP_URL }}
DL_PREFERRED_SUBDOMAIN_PROVIDER: ${{ secrets.DEPLOY_PROD_DL_PREFERRED_SUBDOMAIN_PROVIDER }}
DL_SHODAN_URL: ${{ secrets.DEPLOY_PROD_DL_SHODAN_URL }}
DL_DEMO_USER: ${{ secrets.DEPLOY_DEMO_DL_DEMO_USER }}
DL_DEMO_PASS: ${{ secrets.DEPLOY_DEMO_DL_DEMO_PASS }}
NITRO_PRESET: 'vercel'
DL_ENV_TYPE: 'demo'
run: |
NODE_OPTIONS=--max-old-space-size=8192 npm run build:vercel
# Build step for main or other branches
- name: Build for Vercel (prod/feature)
if: ${{ steps.determine_branch.outputs.branchName != 'demo' }}
env:
DL_STRIPE_CANCEL_URL: ${{ secrets.DEPLOY_PROD_DL_STRIPE_CANCEL_URL }}
DL_STRIPE_CHECKOUT_URL: ${{ secrets.DEPLOY_PROD_DL_STRIPE_CHECKOUT_URL }}
SUPABASE_ANON_KEY: ${{ secrets.DEPLOY_PROD_SUPABASE_ANON_KEY }}
SUPABASE_URL: ${{ secrets.DEPLOY_PROD_SUPABASE_URL }}
DL_SUPABASE_PROJECT: ${{ secrets.DEPLOY_PROD_DL_SUPABASE_PROJECT }}
DL_DNSDUMP_URL: ${{ secrets.DEPLOY_PROD_DL_DNSDUMP_URL }}
DL_PREFERRED_SUBDOMAIN_PROVIDER: ${{ secrets.DEPLOY_PROD_DL_PREFERRED_SUBDOMAIN_PROVIDER }}
DL_SHODAN_URL: ${{ secrets.DEPLOY_PROD_DL_SHODAN_URL }}
NITRO_PRESET: 'vercel'
DL_ENV_TYPE: 'managed'
run: |
NODE_OPTIONS=--max-old-space-size=8192 npm run build:vercel
- name: Deploy to Vercel
if: ${{ success() }}
run: |
npm install -g vercel
BRANCH="${{ steps.determine_branch.outputs.branchName }}"
if [ "$BRANCH" = "main" ]; then
echo "Deploying to production"
npx vercel deploy --prebuilt --prod --yes --token $VERCEL_TOKEN
elif [ "$BRANCH" = "demo" ]; then
echo "Deploying to demo"
npx vercel deploy --prebuilt --yes --target=demo --token $VERCEL_TOKEN
else
echo "Deploying to feature environment"
npx vercel deploy --prebuilt --yes --target=staging --token $VERCEL_TOKEN
fi
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}