Skip to content

chore: update Gh action #3

chore: update Gh action

chore: update Gh action #3

name: build-and-deploy
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
NEXT_PUBLIC_CLERK_SIGN_IN_URL: ${{ secrets.NEXT_PUBLIC_CLERK_SIGN_IN_URL }}
NEXT_PUBLIC_CLERK_SIGN_UP_URL: ${{ secrets.NEXT_PUBLIC_CLERK_SIGN_UP_URL }}
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL: ${{ secrets.NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL }}
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL: ${{ secrets.NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL }}
NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }}
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
DIRECT_URL: ${{ secrets.DIRECT_URL }}
UPLOADTHING_SECRET: ${{ secrets.UPLOADTHING_SECRET }}
UPLOADTHING_APP_ID: ${{ secrets.UPLOADTHING_APP_ID }}
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
NEXT_PUBLIC_LIVEKIT_URL: ${{ secrets.NEXT_PUBLIC_LIVEKIT_URL }}
ENV_CODE: prod
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '19'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Deploy to EC2 instance
run: |
ssh -o StrictHostKeyChecking=no -i 'd:/personal-project/discord-clone-docs/chatcord-key-pair.pem' [email protected] 'cd /home/ubuntu/discord-clone && git pull && npm install && npm run build'
# - name: Deploy to AWS
# uses: easingthemes/aws-elasticbeanstalk-deploy@v3
# with:
# access_key: ${{ secrets.AWS_ACCESS_KEY }}
# secret_key: ${{ secrets.AWS_SECRET_KEY }}
# region: your-aws-region
# application_name: your-application-name
# environment_name: your-environment-name
# zip_file: build.zip