-
Notifications
You must be signed in to change notification settings - Fork 2
119 lines (101 loc) · 4.2 KB
/
Dev-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
name: Dev - CI/CD
on:
push:
branches: [ develop ]
paths-ignore:
- ".github/workflows/**"
workflow_dispatch:
jobs:
sonar:
runs-on: self-hosted
if: ${{ github.ref == 'refs/heads/develop' }}
steps:
- uses: actions/checkout@v2
- name: Sonar
uses: luizhpriotto/[email protected]
env:
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST: http://sonar.sme.prefeitura.sp.gov.br/
- 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 }}
build:
runs-on: self-hosted
if: ${{ github.ref == 'refs/heads/develop' }}
needs: [ sonar ]
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:
runs-on: self-hosted
needs: [ build ]
if: ${{ github.ref == 'refs/heads/develop' }}
environment:
name: development
steps:
- name: Redeploy
uses: luizhpriotto/[email protected]
env:
RANCHER_URL: ${{ secrets.RANCHER_URL }}
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }}
NAMESPACE: sme-ptrf
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 }}
- name: send success message
if: ${{ success() }}
uses: appleboy/telegram-action@master
with:
to: -571051431
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
🚀 Success 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 }}