feat: script CD #5
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: Continue Deployment | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
deploy: | |
name: SSH using key | |
runs-on: ubuntu-latest | |
steps: | |
- name: executing remote ssh commands using ssh key | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.PK_VM }} | |
port: ${{ secrets.SSH_PORT }} | |
script: | | |
pm2 list | |
rm -rf thread-api | |
git clone https://github.com/ramamimu/thread-api.git thread-api | |
cp /home/ahm_f_ramadhani/.env thread-api/.env | |
cd thread-api | |
npm install --omit=dev | |
pm2 restart src/app.js --name node-service |