Skip to content

Commit

Permalink
Merge pull request #11 from ali-hosseini-deriv/ako/add-vercel-DR-action
Browse files Browse the repository at this point in the history
Ako/ add vercel DR action
  • Loading branch information
balakrishna-deriv authored Jun 28, 2024
2 parents ef7f41d + f8d2f92 commit 99bb7aa
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/actions/vercel_DR_publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy to Vercel
description: Deploy to Vercel
inputs:
VERCEL_ORG_ID:
description: Vercel organization ID
required: true
VERCEL_PROJECT_ID:
description: Vercel project ID
required: true
VERCEL_TOKEN:
description: Vercel token
required: true
ENVIRONMENT:
description: Environment
required: true
VERCEL_SCOPE:
description: Vercel scope
required: true
ALIAS_DOMAIN_URL:
description: Alias domain
required: false

runs:
using: composite
steps:
- name: Install Vercel CLI
run: npm install -g vercel
shell: bash

- name: Pull Vercel project
shell: bash
env:
VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }}
VERCEL_SCOPE: ${{ inputs.VERCEL_SCOPE }}
run: |
vercel pull --yes --token=$VERCEL_TOKEN --scope=$VERCEL_SCOPE
- name: Deploy to Vercel (Staging)
env:
VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }}
VERCEL_SCOPE: ${{ inputs.VERCEL_SCOPE }}
ALIAS_DOMAIN_URL: ${{ inputs.ALIAS_DOMAIN_URL }}

if: ${{ inputs.ENVIRONMENT }} == 'Staging'
shell: bash
run: |
vercel build --yes --token=$VERCEL_TOKEN --scope=$VERCEL_SCOPE
url="$(vercel deploy --prebuilt --token=$VERCEL_TOKEN --scope=$VERCEL_SCOPE)"
vercel alias "$url" $ALIAS_DOMAIN_URL --token=$VERCEL_TOKEN --scope=$VERCEL_SCOPE
- name: Deploy to Vercel (Production)
env:
VERCEL_TOKEN: ${{ inputs.VERCEL_TOKEN }}
VERCEL_SCOPE: ${{ inputs.VERCEL_SCOPE }}
ALIAS_DOMAIN_URL: ${{ inputs.ALIAS_DOMAIN_URL }}
if: ${{ inputs.ENVIRONMENT }} == 'Production'
shell: bash
run: |
vercel build --yes --prod --token=$VERCEL_TOKEN --scope=$VERCEL_SCOPE
url="$(vercel deploy --prod --prebuilt --token=$VERCEL_TOKEN --scope=$VERCEL_SCOPE)"
vercel alias "$url" $ALIAS_DOMAIN_URL --token=$VERCEL_TOKEN --scope=$VERCEL_SCOPE

0 comments on commit 99bb7aa

Please sign in to comment.