-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (115 loc) · 4.46 KB
/
cicd.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
name: CI/CD
concurrency: production
on:
push:
branches: [master]
jobs:
check_changes:
runs-on: ubuntu-latest
outputs:
backend_ci: ${{ steps.filter.outputs.backend_ci }}
backend_cd: ${{ steps.filter.outputs.backend_cd }}
backend_playwright_cd: ${{ steps.filter.outputs.backend_playwright_cd }}
frontend_cd: ${{ steps.filter.outputs.frontend_cd }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
backend_ci:
- './volumes/backend/**'
- './containers/backend/**'
backend_cd:
- './volumes/backend/!(spec)/**'
- './containers/backend/**'
backend_playwright_cd:
- './containers/backend_playwright/**'
frontend_cd:
- './volumes/frontend/**'
- './containers/frontend/**'
backend_ci:
needs: check_changes
if: ${{ needs.check_changes.outputs.backend_ci == 'true' }}
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Execute CI
run: |
touch .env
docker compose build backend
docker compose run backend rails db:create
docker compose run backend rails db:migrate
docker compose run backend rspec
- name: Set CI Result
if: ${{ success() }}
run: echo "result=true" >> $GITHUB_OUTPUT
backend_cd:
needs:
- check_changes
- backend_ci
if: ${{ needs.check_changes.outputs.backend_cd == 'true' }}
uses: ./.github/workflows/reusable-cd.yml
with:
service_name: "k8s/manifests/price-monitoring"
build_command: "make build-backend tag_suffix=${{ github.sha }}"
push_command: "make push-backend tag_suffix=${{ github.sha }}"
apply_command: "make apply-backend tag_suffix=${{ github.sha }}"
secrets:
REGISTRY_IP: ${{ secrets.REGISTRY_IP }}
REGISTRY_CRT: ${{ secrets.REGISTRY_CRT }}
REGISTRY_KEY: ${{ secrets.REGISTRY_KEY }}
CA_CRT: ${{ secrets.CA_CRT }}
CLIENT_CRT: ${{ secrets.CLIENT_CRT }}
CLIENT_KEY: ${{ secrets.CLIENT_KEY }}
SECRET_TEXT: ${{ secrets.SECRET_TEXT }}
VPN_OVPN: ${{ secrets.VPN_OVPN }}
GIT_COMMIT_USER: ${{ secrets.GIT_COMMIT_USER }}
GIT_COMMIT_EMAIL: ${{ secrets.GIT_COMMIT_EMAIL }}
GIT_REPO_USER: ${{ secrets.GIT_REPO_USER }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
backend_playwright_cd:
needs: check_changes
if: ${{ needs.check_changes.outputs.backend_playwright_cd == 'true' }}
uses: ./.github/workflows/reusable-cd.yml
with:
service_name: "k8s/manifests/price-monitoring"
build_command: "make build-backend-playwright tag_suffix=${{ github.sha }}"
push_command: "make push-backend-playwright tag_suffix=${{ github.sha }}"
apply_command: "make apply-backend-playwright tag_suffix=${{ github.sha }}"
secrets:
REGISTRY_IP: ${{ secrets.REGISTRY_IP }}
REGISTRY_CRT: ${{ secrets.REGISTRY_CRT }}
REGISTRY_KEY: ${{ secrets.REGISTRY_KEY }}
CA_CRT: ${{ secrets.CA_CRT }}
CLIENT_CRT: ${{ secrets.CLIENT_CRT }}
CLIENT_KEY: ${{ secrets.CLIENT_KEY }}
SECRET_TEXT: ${{ secrets.SECRET_TEXT }}
VPN_OVPN: ${{ secrets.VPN_OVPN }}
GIT_COMMIT_USER: ${{ secrets.GIT_COMMIT_USER }}
GIT_COMMIT_EMAIL: ${{ secrets.GIT_COMMIT_EMAIL }}
GIT_REPO_USER: ${{ secrets.GIT_REPO_USER }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
frontend_cd:
needs: check_changes
if: ${{ needs.check_changes.outputs.frontend_cd == 'true' }}
uses: ./.github/workflows/reusable-cd.yml
with:
service_name: "k8s/manifests/price-monitoring"
build_command: "make build-frontend tag_suffix=${{ github.sha }}"
push_command: "make push-frontend tag_suffix=${{ github.sha }}"
apply_command: "make apply-frontend tag_suffix=${{ github.sha }}"
secrets:
REGISTRY_IP: ${{ secrets.REGISTRY_IP }}
REGISTRY_CRT: ${{ secrets.REGISTRY_CRT }}
REGISTRY_KEY: ${{ secrets.REGISTRY_KEY }}
CA_CRT: ${{ secrets.CA_CRT }}
CLIENT_CRT: ${{ secrets.CLIENT_CRT }}
CLIENT_KEY: ${{ secrets.CLIENT_KEY }}
SECRET_TEXT: ${{ secrets.SECRET_TEXT }}
VPN_OVPN: ${{ secrets.VPN_OVPN }}
GIT_COMMIT_USER: ${{ secrets.GIT_COMMIT_USER }}
GIT_COMMIT_EMAIL: ${{ secrets.GIT_COMMIT_EMAIL }}
GIT_REPO_USER: ${{ secrets.GIT_REPO_USER }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}