-
Notifications
You must be signed in to change notification settings - Fork 2
169 lines (165 loc) · 5.66 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: ci
on:
push:
branches: [main, release/*, release]
pull_request:
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
ui: ${{ steps.ui.outputs.any_changed }}
api: ${{ steps.api.outputs.any_changed }}
engine: ${{ steps.engine.outputs.any_changed }}
websocket: ${{ steps.websocket.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: changed files for api
id: api
uses: tj-actions/changed-files@v41
with:
files: |
api/**
.github/workflows/ci.yml
.github/workflows/ci_api.yml
.github/workflows/build_api.yml
.github/workflows/deploy_api_nightly.yml
CHANGELOG.md
- name: changed files for ui
id: ui
uses: tj-actions/changed-files@v41
with:
files: |
ui/**
.github/workflows/ci.yml
.github/workflows/ci_ui.yml
.github/workflows/build_ui.yml
.github/workflows/deploy_ui_nightly.yml
CHANGELOG.md
- name: changed files for websocket
id: websocket
uses: tj-actions/changed-files@v41
with:
files: |
websocket/**
.github/workflows/ci.yml
.github/workflows/ci_websocket.yml
CHANGELOG.md
- name: changed files for engine
id: engine
uses: tj-actions/changed-files@v41
with:
files: |
engine/**
.github/workflows/ci.yml
.github/workflows/ci_engine.yml
CHANGELOG.md
ci-api:
needs: prepare
if: needs.prepare.outputs.api == 'true'
uses: ./.github/workflows/ci_api.yml
ci-ui:
needs: prepare
if: needs.prepare.outputs.ui == 'true'
uses: ./.github/workflows/ci_ui.yml
ci-websocket:
needs: prepare
if: needs.prepare.outputs.websocket == 'true'
uses: ./.github/workflows/ci_websocket.yml
ci-engine:
needs: prepare
if: needs.prepare.outputs.engine == 'true'
uses: ./.github/workflows/ci_engine.yml
ci:
runs-on: ubuntu-latest
needs:
- ci-api
- ci-ui
- ci-websocket
- ci-engine
if: '!failure()'
steps:
- run: echo OK
ci-collect-info:
name: Collect information
needs: ci
if: '!failure()'
runs-on: ubuntu-latest
outputs:
sha_short: ${{ steps.info.outputs.sha_short || 'blank' }}
new_tag: ${{ steps.info.outputs.new_tag || 'blank' }}
new_tag_short: ${{ steps.info.outputs.new_tag_short || 'blank' }}
name: ${{ steps.info.outputs.name || 'blank' }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Get info
id: info
env:
BRANCH: ${{github.ref_name}}
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "BRANCH=$BRANCH"
if [[ "$BRANCH" = "release" || "$BRANCH" = "release/"* ]]; then
TAG=$(git tag --points-at HEAD)
if [[ ! -z "$TAG" ]]; then
echo "new_tag=$TAG" >> $GITHUB_OUTPUT
echo "new_tag_short=${TAG#v}" >> $GITHUB_OUTPUT
else
echo "name=rc" >> $GITHUB_OUTPUT
fi
else
echo "name=nightly" >> $GITHUB_OUTPUT
fi
- name: Show info
env:
SHA_SHORT: ${{ steps.info.outputs.sha_short }}
NEW_TAG: ${{ steps.info.outputs.new_tag }}
NEW_TAG_SHORT: ${{ steps.info.outputs.new_tag_short }}
NAME: ${{ steps.info.outputs.name }}
run: echo "sha_short=$SHA_SHORT, new_tag=$NEW_TAG, new_tag_short=$NEW_TAG_SHORT, name=$NAME"
build-and-deploy-api:
needs:
- ci
- ci-api
- ci-collect-info
uses: ./.github/workflows/build_deploy_api.yml
if: ${{ !failure() && needs.ci-api.result == 'success' && github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'release' || startsWith(github.ref_name, 'release/')) }}
with:
sha_short: ${{ needs.ci-collect-info.outputs.sha_short }}
new_tag: ${{ needs.ci-collect-info.outputs.new_tag }}
new_tag_short: ${{ needs.ci-collect-info.outputs.new_tag_short }}
name: ${{ needs.ci-collect-info.outputs.name }}
sha: ${{ github.sha }}
secrets: inherit
build-and-deploy-ui:
needs:
- ci
- ci-ui
- ci-collect-info
uses: ./.github/workflows/build_deploy_ui.yml
if: ${{ !failure() && needs.ci-ui.result == 'success' && github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'release' || startsWith(github.ref_name, 'release/')) }}
with:
sha_short: ${{ needs.ci-collect-info.outputs.sha_short }}
new_tag: ${{ needs.ci-collect-info.outputs.new_tag }}
new_tag_short: ${{ needs.ci-collect-info.outputs.new_tag_short }}
name: ${{ needs.ci-collect-info.outputs.name }}
sha: ${{ github.sha }}
secrets: inherit
build-and-deploy-websocket:
needs:
- ci
- ci-websocket
- ci-collect-info
uses: ./.github/workflows/build_deploy_websocket.yml
if: ${{ !failure() && needs.ci-websocket.result == 'success' && github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'release' || startsWith(github.ref_name, 'release/')) }}
with:
sha_short: ${{ needs.ci-collect-info.outputs.sha_short }}
new_tag: ${{ needs.ci-collect-info.outputs.new_tag }}
new_tag_short: ${{ needs.ci-collect-info.outputs.new_tag_short }}
name: ${{ needs.ci-collect-info.outputs.name }}
sha: ${{ github.sha }}
secrets: inherit