fejifj #18
Workflow file for this run
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: Deploy to Linux Server | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install sshpass | |
run: sudo apt-get install -y sshpass | |
- name: Deploy and start the project | |
env: | |
SSH_IP: ${{ secrets.SSH_IP }} | |
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }} | |
SSH_PORT: ${{ secrets.SSH_PORT }} | |
run: | | |
sshpass -p $SSH_PASSWORD ssh -o StrictHostKeyChecking=no -p $SSH_PORT castberry@$SSH_IP << 'EOF' | |
cd /home/castberry/dailypet | |
git pull | |
git checkout main | |
npm install | |
pm2 restart dailypet-dev || pm2 start npm --name "dailypet-dev" -- run start | |
EOF |