Skip to content

Commit

Permalink
feat: add GitHub Actions workflows for Vercel deployment in developme…
Browse files Browse the repository at this point in the history
…nt and production environments
  • Loading branch information
jis3r committed Dec 8, 2024
1 parent 1d57478 commit 34329b0
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Deploy Vercel"

on:
workflow_call:
inputs:
environment:
required: true
type: string
secrets:
VERCEL_TOKEN:
required: true
VERCEL_ORG_ID:
required: true
VERCEL_PROJECT_ID:
required: true

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Vercel CLI
shell: bash
run: npm i -g vercel
- name: Install Dependencies
shell: bash
run: npm install
- name: Vercel Deploy
shell: bash
run: |
if [ "${{ inputs.environment }}" = "prod" ]; then
vercel pull --environment=production --yes --token=${{ secrets.vercel_token }}
vercel deploy --public --yes --prod --logs --token=${{ secrets.vercel_token }}
else
vercel pull --environment=preview --yes --token=${{ secrets.vercel_token }}
vercel deploy --public --yes --logs --token=${{ secrets.vercel_token }}
fi
17 changes: 17 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Deploy Development"

on:
push:
branches:
- development

jobs:
dev:
name: "dev"
uses: ./.github/workflows/deploy.yml
with:
environment: "dev"
secrets:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Deploy Production"

on:
push:
branches:
- main
repository_dispatch:
workflow_dispatch:

jobs:
prod:
name: "prod"
uses: ./.github/workflows/deploy.yml
with:
environment: "prod"
secrets:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}

0 comments on commit 34329b0

Please sign in to comment.