-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (67 loc) · 2.06 KB
/
cobranzas_dev ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: CI Cobranzas DEV
on:
push:
branches:
- maicol_cobranzas
jobs:
deploy:
runs-on: ubuntu-latest
env:
EC2_HOST: ${{ secrets.IP_COBRANZAS_DEV }}
EC2_USERNAME: ${{ secrets.USERS_COBRANZAS }}
EC2_SSH_KEY: ${{ secrets.PEM_ORG_COBRANZAS_DEV }}
GH_TOKEN: ${{ secrets.TOKEN_COBRANZAS }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install dependencies
uses: appleboy/ssh-action@master
with:
host: ${{ env.EC2_HOST }}
username: ${{ env.EC2_USERNAME }}
key: ${{ env.EC2_SSH_KEY }}
script: |
sudo yum install -y nodejs npm git
- name: Create working directory
uses: appleboy/ssh-action@master
with:
host: ${{ env.EC2_HOST }}
username: ${{ env.EC2_USERNAME }}
key: ${{ env.EC2_SSH_KEY }}
script: |
sudo rm -rf /opt/nombreDeSuDirectorio || true
sudo mkdir -p /opt/nombreDeSuDirectorio
- name: Clone GitHub repo
uses: appleboy/ssh-action@master
with:
host: ${{ env.EC2_HOST }}
username: ${{ env.EC2_USERNAME }}
key: ${{ env.EC2_SSH_KEY }}
script: |
sudo git clone https://${{ env.GH_TOKEN }}@github.com/usuario/repo /opt/nombreDeSuDirectorio
- name: Install npm packages
uses: appleboy/ssh-action@master
with:
host: ${{ env.EC2_HOST }}
username: ${{ env.EC2_USERNAME }}
key: ${{ env.EC2_SSH_KEY }}
script: |
cd /opt/nombreDeSuDirectorio
sudo npm install express pm2
- name: Start service
uses: appleboy/ssh-action@master
with:
host: ${{ env.EC2_HOST }}
username: ${{ env.EC2_USERNAME }}
key: ${{ env.EC2_SSH_KEY }}
script: |
cd /opt/nombreDeSuDirectorio
sudo pm2 start app.js
- name: Check service status
uses: appleboy/ssh-action@master
with:
host: ${{ env.EC2_HOST }}
username: ${{ env.EC2_USERNAME }}
key: ${{ env.EC2_SSH_KEY }}
script: |
sudo pm2 status