cobranzas_dev ci.yml #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: 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/cobranzas-dev || true | |
sudo mkdir -p /opt/cobranzas-dev | |
- name: Clone GitHub repo | |
uses: appleboy/[email protected] | |
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 }}@github.com/alkemyTech/UMSA-DevOps-T3 . | |
- name: Install npm packages | |
uses: appleboy/[email protected] | |
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/[email protected] | |
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/[email protected] | |
with: | |
host: ${{ secrets.IP_COBRANZAS_DEV }} | |
username: ${{ secrets.USERS_COBRANZAS }} | |
key: ${{ secrets.TOKEN_COBRANZAS }} | |
script: | | |
sudo pm2 status |