Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Update deploy.yml

Update deploy.yml #43

Workflow file for this run

name: Deploy Next.js App
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Pnpm
uses: pnpm/[email protected]
with:
version: 8.15.0
- run: pnpm install --frozen-lockfile
- run: pnpm test -- --run
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Pnpm
uses: pnpm/[email protected]
with:
version: 8.15.0
- run: pnpm install --frozen-lockfile
- run: pnpm run build
deploy:
env:
repo: https://github.com/${{ github.repository }}
branch: main
dir: /home/nextjs-large-file-upload_${{ github.sha }}
runs-on: ubuntu-latest
steps:
- name: Use the environment secret
run: echo ${{ secrets.VPS_HOST }}
- name: Use the default environment variables
run: echo ${{ env.branch }} ${{ env.repo }} ${{ env.dir }}
- name: Deploy to VPS
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
port: ${{ secrets.VPS_PORT }}
script: |
git clone --branch ${{ env.branch }} --depth 1 ${{ env.repo }} ${{ env.dir }}
cd ${{ env.dir }}
pnpm install --frozen-lockfile
pnpm run build
pm2 start
pm2 ls
pm2 logs large-file-upload --nostream