-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (45 loc) · 1.54 KB
/
CI_Proveedores-QA.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
name: CI Pipeline - Prov QA
on:
push:
branches:
- martin-prov-qa
env:
SSH_PRIVATE_KEY: ${{ secrets.PEM_PROV_QA }}
REMOTE_USER: ec2-user
REMOTE_HOST: ${{ secrets.IP_PROV_QA }}
GH_TOKEN: ${{ secrets.TOKEN_PROV }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Docker
run: |
sudo apt-get update
sudo apt-get remove -y containerd.io # Elimina containerd.io si está instalado
sudo apt-get install -y docker.io
- name: Build Docker Image
run: |
docker build . -t 471626/imagen-prov-qa:latest
- name: Login to Docker Hub
run: echo "${{ secrets.TOKEN_PROV_QA }}" | docker login -u 471626 --password-stdin
- name: Push to Docker Hub
run: docker push 471626/imagen-prov-qa:latest
- name: Deploy to QA Environment (using secrets)
run:
ssh -i ${{ secrets.PEM_PROV_QA }} ec2-user@${{ secrets.IP_PROV_QA }} 'docker pull 471626/imagen-prov-qa && docker run -d -p 3000:3000 471626/imagen-prov-qa' |
# docker pull 471626/imagen-prov-qa
- name: Verify Service is Running
uses: appleboy/ssh-action@master
with:
host: ${{ env.REMOTE_HOST }}
username: ${{ env.REMOTE_USER }}
key: ${{ env.SSH_PRIVATE_KEY }}
script: |
if netstat -an | grep :3000; then
echo "App ok"
else
echo "Error"
exit 1
fi