Deploy to Production (#384) #278
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Backend (Development Preview) | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_BACKEND_DEV_ID }} | |
on: | |
push: | |
paths: | |
- 'backend/**' | |
- '.github/workflows/backend-dev-preview.yml' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create env File | |
working-directory: ./backend | |
run: | | |
touch .env | |
echo ENV=DEV >> .env | |
echo PORT=3000 >> .env | |
echo MONGO_URI="${{ secrets.MONGO_URI_DEV }}" >> .env | |
echo JWT_SECRET=${{ secrets.JWT_SECRET_DEV }} >> .env | |
echo BREVO_CLIENT_EMAIL=${{ secrets.BREVO_CLIENT_EMAIL }} >> .env | |
echo BREVO_CLIENT_PASSWORD=${{ secrets.BREVO_CLIENT_PASSWORD }} >> .env | |
echo GOOGLE_RECAPTCHA_SECRET_KEY=${{ secrets.GOOGLE_RECAPTCHA_SECRET_KEY }} >> .env | |
echo AWS_COGNITO_CLIENT_ID=${{ secrets.AWS_COGNITO_CLIENT_ID_DEV }} >> .env | |
echo AWS_COGNITO_USERPOOL_ID=${{ secrets.AWS_COGNITO_USERPOOL_ID_DEV }} >> .env | |
echo AWS_ACCESS_KEY_ID="${{ secrets.AWS_ACCESS_KEY_ID }}" >> .env | |
echo AWS_SECRET_ACCESS_KEY="${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> .env | |
echo AWS_REGION=${{ secrets.AWS_REGION }} >> .env | |
- name: Install Vercel CLI | |
working-directory: ./backend | |
run: | | |
npm install --global vercel@canary | |
- name: Pull, Build & Deploy | |
working-directory: ./backend | |
run: | | |
npm ci | |
npm run build | |
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} | |
vercel build --token=${{ secrets.VERCEL_TOKEN }} | |
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} |