-
Notifications
You must be signed in to change notification settings - Fork 2
132 lines (112 loc) · 4.48 KB
/
CI-CD.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: CI/CD
on:
push:
branches: [ master, homolog, homolog-r2 ]
paths-ignore:
- ".github/workflows/**"
workflow_dispatch:
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Login to registry
uses: docker/login-action@v1
with:
registry: ${{ secrets.REGISTRY_HOST }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PWD }}
- name: Build the Docker image
run: |
docker build . --tag ${{ secrets.REGISTRY_HOST }}/${GITHUB_REF##*/}/ptrf-frontend
docker push ${{ secrets.REGISTRY_HOST }}/${GITHUB_REF##*/}/ptrf-frontend
- name: send failure message
if: ${{ failure() }}
uses: appleboy/telegram-action@master
with:
to: -571051431
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
💥 Failed in ${{ github.ref_name }}!
${{ github.actor }} created commit:
Commit message: ${{ github.event.commits[0].message }}
Repository: ${{ github.repository }}
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
Actions: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
deploy-hom:
runs-on: self-hosted
needs: [ build ]
if: ${{ github.ref != 'refs/heads/master' }}
environment:
name: release
steps:
- name: Redeploy Hom
if: ${{ github.ref == 'refs/heads/homolog' }}
uses: luizhpriotto/[email protected]
env:
RANCHER_URL: ${{ secrets.RANCHER_URL }}
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }}
NAMESPACE: sme-ptrf
WORKLOAD: ptrf-frontend
- name: Redeploy Hom2
if: ${{ github.ref == 'refs/heads/homolog-r2' }}
uses: luizhpriotto/[email protected]
env:
RANCHER_URL: ${{ secrets.RANCHER_URL }}
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }}
NAMESPACE: sme-ptrf-hom2
WORKLOAD: ptrf-frontend
- name: send failure message
if: ${{ failure() }}
uses: appleboy/telegram-action@master
with:
to: -571051431
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
💥 Failed in ${{ github.ref_name }}!
${{ github.actor }} created commit:
Commit message: ${{ github.event.commits[0].message }}
Repository: ${{ github.repository }}
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
Actions: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
deploy-prod:
runs-on: self-hosted
needs: [ build ]
if: ${{ github.ref == 'refs/heads/master' }}
environment:
name: production
steps:
- name: Redeploy Prod
uses: luizhpriotto/[email protected]
env:
RANCHER_URL: ${{ secrets.RANCHER_URL }}
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }}
NAMESPACE: sme-ptrf
WORKLOAD: ptrf-frontend
- name: Redeploy Treinamento
uses: luizhpriotto/[email protected]
env:
RANCHER_URL: ${{ secrets.RANCHER_URL }}
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }}
NAMESPACE: sigescola-treinamento
WORKLOAD: treinamento-frontend
- name: Redeploy Treinamento 2
uses: luizhpriotto/[email protected]
env:
RANCHER_URL: ${{ secrets.RANCHER_URL }}
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }}
NAMESPACE: sigescola-treinamento2
WORKLOAD: treinamento-frontend
- name: send failure message
if: ${{ failure() }}
uses: appleboy/telegram-action@master
with:
to: -571051431
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
💥 Failed in ${{ github.ref_name }}!
${{ github.actor }} created commit:
Commit message: ${{ github.event.commits[0].message }}
Repository: ${{ github.repository }}
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
Actions: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}