-
Notifications
You must be signed in to change notification settings - Fork 13
205 lines (173 loc) · 5.61 KB
/
ci-build.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
on:
push:
branches:
- master
- beta
- develop
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*'
pull_request:
branches:
- master
- beta
- develop
types: [opened, reopened, synchronize]
workflow_dispatch: # Manually invoked by user.
name: ci-build
env:
PNPM_VERSION: 9
NODE_VERSION: 20
PYTHON_VERSION: 3.12
jobs:
getvars:
uses: ./.github/workflows/get-vars.yml
build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
frontend
- uses: ./.github/actions/build-frontend
with:
pnpm-version: ${{ env.PNPM_VERSION }}
node-version: ${{ env.NODE_VERSION }}
build-staticfs:
runs-on: ubuntu-latest
needs: build-frontend
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-staticfs
with:
version: ${{ needs.getvars.outputs.version }}
skip-checkout: true
build-firmware:
needs: [getvars]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.getvars.outputs.board-matrix) }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-firmware
with:
board: ${{ matrix.board }}
version: ${{ needs.getvars.outputs.version }}
skip-checkout: true
merge-partitions:
needs: [getvars, build-staticfs, build-firmware]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.getvars.outputs.board-matrix) }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
scripts
boards
chips
- uses: ./.github/actions/merge-partitions
with:
version: ${{ needs.getvars.outputs.version }}
board: ${{ matrix.board }}
skip-checkout: true
checkpoint-build:
runs-on: ubuntu-latest
needs: [merge-partitions]
steps:
- run: echo "Builds checkpoint reached"
cdn-upload-firmware:
needs: [getvars, checkpoint-build]
if: ${{ needs.getvars.outputs.should-deploy == 'true' }}
runs-on: ubuntu-latest
environment: cdn-firmware-r2
strategy:
fail-fast: true
matrix: ${{ fromJson(needs.getvars.outputs.board-matrix) }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
# Set up rclone for CDN uploads.
- uses: ./.github/actions/cdn-prepare
with:
bunny-ssh-knownhosts: ${{ vars.BUNNY_SSH_KNOWNHOSTS }}
# Upload firmware to CDN.
- uses: ./.github/actions/cdn-upload-firmware
with:
bunny-stor-hostname: ${{ vars.BUNNY_STOR_HOSTNAME }}
bunny-stor-username: ${{ secrets.BUNNY_STOR_USERNAME }}
bunny-stor-password: ${{ secrets.BUNNY_STOR_PASSWORD }}
fw-version: ${{ needs.getvars.outputs.version }}
board: ${{ matrix.board }}
cdn-upload-version-info:
needs: [getvars, checkpoint-build]
if: ${{ needs.getvars.outputs.should-deploy == 'true' }}
runs-on: ubuntu-latest
environment: cdn-firmware-r2
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
# Set up rclone for CDN uploads.
- uses: ./.github/actions/cdn-prepare
with:
bunny-ssh-knownhosts: ${{ vars.BUNNY_SSH_KNOWNHOSTS }}
# Upload firmware to CDN.
- uses: ./.github/actions/cdn-upload-version-info
with:
bunny-stor-hostname: ${{ vars.BUNNY_STOR_HOSTNAME }}
bunny-stor-username: ${{ secrets.BUNNY_STOR_USERNAME }}
bunny-stor-password: ${{ secrets.BUNNY_STOR_PASSWORD }}
fw-version: ${{ needs.getvars.outputs.version }}
release-channel: ${{ needs.getvars.outputs.release-channel }}
boards: ${{ needs.getvars.outputs.board-list }}
cdn-bump-version:
runs-on: ubuntu-latest
needs: [getvars, cdn-upload-firmware] # only after version is complete
environment: cdn-firmware-r2
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
# Set up rclone for CDN uploads.
- uses: ./.github/actions/cdn-prepare
with:
bunny-ssh-knownhosts: ${{ vars.BUNNY_SSH_KNOWNHOSTS }}
# Upload firmware to CDN.
- uses: ./.github/actions/cdn-bump-version
with:
bunny-stor-hostname: ${{ vars.BUNNY_STOR_HOSTNAME }}
bunny-stor-username: ${{ secrets.BUNNY_STOR_USERNAME }}
bunny-stor-password: ${{ secrets.BUNNY_STOR_PASSWORD }}
version: ${{ needs.getvars.outputs.version }}
release-channel: ${{ needs.getvars.outputs.release-channel }}
checkpoint-cdn:
runs-on: ubuntu-latest
needs: [cdn-upload-firmware, cdn-upload-version-info, cdn-bump-version]
steps:
- run: echo "CDN checkpoint reached"
release:
needs: [getvars, checkpoint-cdn]
if: (needs.getvars.outputs.release-channel == 'stable' || needs.getvars.outputs.release-channel == 'beta')
runs-on: ubuntu-latest
steps:
- name: Download release artifacts
uses: actions/download-artifact@v4
- name: Display artifacts
run: ls -R
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: '**/OpenShock_*.bin'
tag: ${{ needs.getvars.outputs.version }}
prerelease: ${{ needs.getvars.outputs.release-channel != 'stable' }}
artifactErrorsFailBuild: true
body: ${{ needs.getvars.outputs.release-notes }}