-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (42 loc) · 1.41 KB
/
CI_Pipeline-DEV2.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
name: CI Pipeline - DEV
on:
push:
branches:
- martin-proveedores
env:
SSH_PRIVATE_KEY: ${{ secrets.PEM_PROV_DEV }}
REMOTE_USER: ec2-user
REMOTE_HOST: ${{ secrets.IP_PROV_DEV }}
GH_TOKEN: ${{ secrets.TOKEN_PROV }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install Node.js, NPM, and Git
run: |
sudo apt-get update
sudo apt-get install nodejs npm git -y
- name: Create Working Directory
run: sudo mkdir -p /opt/appDir
- name: Clone Repo
uses: appleboy/ssh-action@master
with:
host: ${{ env.REMOTE_HOST }}
username: ${{ env.REMOTE_USER }}
key: ${{ env.SSH_PRIVATE_KEY }}
script: |
sudo rm -rf /opt/appDir/repo # Remove directory if exists
sudo git clone https://${{ secrets.TOKEN_PROV }}@github.com/alkemyTech/UMSA-DevOps-T3 .
- name: Install NPM Packages
run: |
sudo npm install -g express pm2
cd /opt/appDir/repo
npm install
- name: Start Node Service
run: |
sudo pm2 start /opt/appDir/repo/app.js
- name: Check if Application is Running
run: |
sudo pm2 status