Skip to content

cobranzas_dev ci.yml #3

cobranzas_dev ci.yml

cobranzas_dev ci.yml #3

name: CI Cobranzas DEV
on:
push:
branches:
- maicol_cobranzas
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install dependencies
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.IP_COBRANZAS_DEV }}
username: ${{ secrets.USERS_COBRANZAS }}
key: ${{ secrets.TOKEN_COBRANZAS }}
script: |
sudo yum install -y nodejs npm git
- name: Create working directory
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.IP_COBRANZAS_DEV }}
username: ${{ secrets.USERS_COBRANZAS }}
key: ${{ secrets.TOKEN_COBRANZAS }}
script: |
sudo rm -rf /opt/nombreDeSuDirectorio || true
sudo mkdir -p /opt/nombreDeSuDirectorio
- name: Clone GitHub repo
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.IP_COBRANZAS_DEV }}
username: ${{ secrets.USERS_COBRANZAS }}
key: ${{ secrets.TOKEN_COBRANZAS }}
script: |
sudo git clone -b maicol_cobranzas https://${{ secrets.TOKEN_COBRANZAS_DEV }}@github.com/alkemyTech/UMSA-DevOps-T3 .
- name: Install npm packages
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.IP_COBRANZAS_DEV }}
username: ${{ secrets.USERS_COBRANZAS }}
key: ${{ secrets.TOKEN_COBRANZAS }}
script: |
cd /opt/nombreDeSuDirectorio
sudo npm install express pm2
- name: Start service
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.IP_COBRANZAS_DEV }}
username: ${{ secrets.USERS_COBRANZAS }}
key: ${{ secrets.TOKEN_COBRANZAS }}
script: |
cd /opt/nombreDeSuDirectorio
sudo pm2 start app.js
- name: Check service status
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.IP_COBRANZAS_DEV }}
username: ${{ secrets.USERS_COBRANZAS }}
key: ${{ secrets.TOKEN_COBRANZAS }}
script: |
sudo pm2 status