-
Notifications
You must be signed in to change notification settings - Fork 4
146 lines (133 loc) · 4.53 KB
/
ci.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: ci
on:
push:
branches: [main, release]
pull_request:
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
web: ${{ steps.web.outputs.any_modified }}
server: ${{ steps.server.outputs.any_modified }}
worker: ${{ steps.worker.outputs.any_modified }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: changed files for web
id: web
uses: tj-actions/changed-files@v45
with:
files: |
web/**
.github/workflows/ci.yml
.github/workflows/ci_web.yml
.github/workflows/build_web.yml
- name: changed files for server
id: server
uses: tj-actions/changed-files@v45
with:
files: |
server/**
.github/workflows/ci.yml
.github/workflows/ci_server.yml
.github/workflows/build_server.yml
- name: changed files for worker
id: worker
uses: tj-actions/changed-files@v45
with:
files: |
worker/**
.github/workflows/ci.yml
.github/workflows/ci_worker.yml
.github/workflows/build_worker.yml
ci-web:
needs: prepare
if: needs.prepare.outputs.web == 'true'
uses: ./.github/workflows/ci_web.yml
ci-server:
needs: prepare
if: needs.prepare.outputs.server == 'true'
uses: ./.github/workflows/ci_server.yml
ci-worker:
needs: prepare
if: needs.prepare.outputs.worker == 'true'
uses: ./.github/workflows/ci_worker.yml
ci:
runs-on: ubuntu-latest
needs:
- ci-web
- ci-server
- ci-worker
if: '!failure()'
steps:
- run: echo OK
build-prepare:
needs: prepare
if: ${{ github.repository == 'reearth/reearth-cms' && github.event_name == 'push' && (github.ref_name == 'release' || !startsWith(github.event.head_commit.message, 'v')) }}
uses: ./.github/workflows/build_prepare.yml
build-web:
needs: [prepare, build-prepare]
if: needs.prepare.outputs.web == 'true'
uses: ./.github/workflows/build_web.yml
with:
name: ${{ needs.build-prepare.outputs.name }}
new_tag: ${{ needs.build-prepare.outputs.new_tag }}
new_tag_short: ${{ needs.build-prepare.outputs.new_tag_short }}
sha_short: ${{ needs.build-prepare.outputs.sha_short }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
build-server:
needs: [prepare, build-prepare]
if: needs.prepare.outputs.server == 'true'
uses: ./.github/workflows/build_server.yml
with:
name: ${{ needs.build-prepare.outputs.name }}
new_tag: ${{ needs.build-prepare.outputs.new_tag }}
new_tag_short: ${{ needs.build-prepare.outputs.new_tag_short }}
sha_short: ${{ needs.build-prepare.outputs.sha_short }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
build-worker:
needs: [prepare, build-prepare]
if: needs.prepare.outputs.worker == 'true'
uses: ./.github/workflows/build_worker.yml
with:
name: ${{ needs.build-prepare.outputs.name }}
new_tag: ${{ needs.build-prepare.outputs.new_tag }}
new_tag_short: ${{ needs.build-prepare.outputs.new_tag_short }}
sha_short: ${{ needs.build-prepare.outputs.sha_short }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
deploy-web:
needs: [build-web, ci-web]
if: needs.ci-web.result == 'success'
uses: ./.github/workflows/deploy_test.yml
with:
target: web
secrets:
GCP_SA_EMAIL: ${{ secrets.GCP_SA_EMAIL }}
GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
deploy-server:
needs: [build-server, ci-server]
if: needs.ci-server.result == 'success'
uses: ./.github/workflows/deploy_test.yml
with:
target: server
secrets:
GCP_SA_EMAIL: ${{ secrets.GCP_SA_EMAIL }}
GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
deploy-worker:
needs: [build-worker, ci-worker]
if: needs.ci-worker.result == 'success'
uses: ./.github/workflows/deploy_test.yml
with:
target: worker
secrets:
GCP_SA_EMAIL: ${{ secrets.GCP_SA_EMAIL }}
GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}