Skip to content

update npm run dev with nohup #9

update npm run dev with nohup

update npm run dev with nohup #9

Workflow file for this run

name: Deploy Project to EC2
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.EC2_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.EC2_HOST }} >> ~/.ssh/known_hosts
- name: Connect to EC2 and deploy
run: |
ssh -i ~/.ssh/id_rsa ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "\
source ~/.nvm/nvm.sh && \
cd Full-Stack-Project-Assessment && \
git checkout main && \
git pull && \
npm run build && \
nohup npm run dev > /dev/null 2>&1 &"