60 lines
1.9 KiB
YAML
60 lines
1.9 KiB
YAML
name: Deploy FrontEnd
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
|
|
jobs:
|
|
deploy-staging:
|
|
if: github.ref == 'refs/heads/develop'
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID_STAGING }}
|
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_STAGING }}
|
|
ENV_VARIABLE: ${{ secrets.ENV_STAGING }}
|
|
|
|
steps:
|
|
- name: 🏗 Setup repo
|
|
uses: actions/checkout@v3
|
|
|
|
- name: 🏗 Config .env
|
|
run: echo "$ENV_VARIABLE" > .env
|
|
|
|
- name: 🏗 Install Vercel CLI
|
|
run: npm install --global vercel@latest
|
|
|
|
- name: 🏗 Pull staging app from vercel environment
|
|
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_AUTH_TOKEN }}
|
|
|
|
- name: 📦 Build staging app artifacts
|
|
run: vercel build --prod --token=${{ secrets.VERCEL_AUTH_TOKEN }}
|
|
|
|
- name: 📦 Deploy staging app artifacts to vercel
|
|
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_AUTH_TOKEN }}
|
|
|
|
deploy-production:
|
|
if: github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
ENV_VARIABLE: ${{ secrets.ENV_PROD }}
|
|
|
|
steps:
|
|
- name: 🏗 Setup repo
|
|
uses: actions/checkout@v3
|
|
|
|
- name: 🏗 Config .env
|
|
run: echo "$ENV_VARIABLE" > .env
|
|
|
|
- name: 🏗 Install Vercel CLI
|
|
run: npm install --global vercel@latest
|
|
|
|
- name: 🏗 Pull production vercel environment
|
|
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_AUTH_TOKEN }}
|
|
|
|
- name: 📦 Build app artifacts
|
|
run: vercel build --prod --token=${{ secrets.VERCEL_AUTH_TOKEN }}
|
|
|
|
- name: 📦 Deploy app artifacts to vercel in production
|
|
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_AUTH_TOKEN }} |