Skip to content

chore: Update dependencies and code formatting #115

chore: Update dependencies and code formatting

chore: Update dependencies and code formatting #115

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Main Branch
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Install Yarn
run: npm install -g yarn
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Create .env
run: |
echo NEXT_PUBLIC_SUPABASE_URL=${{ secrets.NEXT_PUBLIC_SUPABASE_URL }} >> lazyweb/.env
echo NEXT_PUBLIC_SUPABASE_ANON_KEY=${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }} >> lazyweb/.env
echo NEXT_PUBLIC_WEBSITE_SCREENSHOT_API_ENDPOINT=${{ secrets.NEXT_PUBLIC_WEBSITE_SCREENSHOT_API_ENDPOINT }} >> lazyweb/.env
echo NEXT_PUBLIC_LAZYWEB_BACKEND_URL=${{ secrets.NEXT_PUBLIC_LAZYWEB_BACKEND_URL }} >> lazyweb/.env
echo NEXT_PUBLIC_META_DATA_ENDPOINT=${{ secrets.NEXT_PUBLIC_META_DATA_ENDPOINT }} >> lazyweb/.env
echo NEXT_PUBLIC_GA_MEASUREMENT_ID=${{ secrets.NEXT_PUBLIC_GA_MEASUREMENT_ID }} >> lazyweb/.env
- name: Check .env file
run: |
wc -m lazyweb/.env
- name: Build Website
run: yarn build
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.PRIVATE_KEY }}
known_hosts: "unnecessary"
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.HOST }} >> ~/.ssh/known_hosts
- name: Deploy with rsync
run: rsync -avz --delete --include='.env' . ${{ secrets.USERNAME }}@${{ secrets.HOST }}:${{ secrets.TARGET_DIRECTORY }}
- name: PM2 Restart
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
port: 22
script: |
pm2 restart all