test #12
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: 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: Clear npm cache | |
run: npm cache clean --force | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '19.x' | |
- name: use cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
key: 19.x-node_modules-${{ hashFiles('package-lock.json') }} | |
restore-keys: 19.x-node_modules- # Take any latest cache if failed to find it for current lock | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Copy Artifact | |
run: | | |
scp -r -i "D:\personal-project\discord-clone-docs\chatcord-key-pair.pem" -r .\.next\* [email protected]:~\.next | |
# - name: Deploy to EC2 instance | |
# run: | | |
# ssh -o StrictHostKeyChecking=no -i '${{ secrets.PRIVATE_KEY }}' ${{ secrets.USER }} 'cd ${{ secrets.PATH }} && git pull && npm install && npm run build' |