-
Notifications
You must be signed in to change notification settings - Fork 3
466 lines (420 loc) · 19.5 KB
/
build_img.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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
name: build headless image
on:
workflow_dispatch:
push:
branches:
- master
paths:
- '.github/workflows/build_img.yml'
- 'build_raspOVOS.sh'
- 'services/**'
- 'settings/**'
- 'packages/setup_rustbus.sh'
- 'packages/ggwave*'
- 'packages/nltk_data/**'
- 'tuning/etc_issue'
- 'tuning/.cli_login.sh'
- 'tuning/.logo.sh'
- 'tuning/.bashrc'
- 'tuning/.bash_aliases'
jobs:
# Stage 1: Get Current Date and Release Name
get-date-release-name:
runs-on: ubuntu-latest
outputs:
release_name: ${{ steps.current-date.outputs.release_name }}
cache_key: ${{ steps.current-date.outputs.cache_key }}
steps:
- name: Get Current Date and Release Name
id: current-date
run: |
current_date=$(date +'%Y-%m-%d')
release_name="raspOVOS-bookworm-arm64-lite-${current_date}"
cache_key="raspOVOS-${{ github.run_id }}"
echo "release_name=$release_name" >> $GITHUB_OUTPUT
echo "cache_key=$cache_key" >> $GITHUB_OUTPUT
- name: Print outputs
shell: bash
run: |
echo "cache_key: ${{ steps.current-date.outputs.cache_key }}"
echo "release_name: ${{ steps.current-date.outputs.release_name }}"
# Stage 2: Build Image
modify-rpi-image:
runs-on: ubuntu-latest
needs: get-date-release-name
outputs:
image-path: ${{ steps.create-image.outputs.image-path }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Add OVOS to Raspberry Pi OS Bookworm
uses: TigreGotico/rpi-image-modifier@main
id: create-image
env:
USER: 'ovos'
PASSWORD: 'ovos'
HOSTNAME: "raspOVOS"
CONSTRAINTS: "https://github.com/OpenVoiceOS/ovos-releases/raw/refs/heads/main/constraints-alpha.txt"
with:
base-image-url: https://github.com/TigreGotico/raspOVOS/releases/download/raspOVOS-NO-OVOS-bookworm-arm64-lite-2024-12-27/raspOVOS-NO-OVOS-bookworm-arm64-lite.img.xz
image-path: raspOVOS-bookworm-arm64-lite.img
compress-with-xz: true
shrink: true
cache: false
mount-repository: true
env-vars: USER,PASSWORD,HOSTNAME,CONSTRAINTS
script-path: build_raspOVOS.sh
- name: Print outputs
shell: bash
run: |
echo "image-path: ${{ steps.create-image.outputs.image-path }}"
echo "image-size: ${{ steps.create-image.outputs.image-size }}"
echo "image-sha256sum: ${{ steps.create-image.outputs.image-sha256sum }}"
- name: Save Image to Cache
uses: actions/cache@v4
with:
path: .
key: ${{ needs.get-date-release-name.outputs.cache_key }}
# Stage 3: Check if Release Exists and Create if Needed
check-release-or-create:
runs-on: ubuntu-latest
needs: [ get-date-release-name, modify-rpi-image ]
outputs:
release_id: ${{ steps.get-release-id.outputs.release_id }}
steps:
- name: Check if Release Exists
id: get-release-id
run: |
release_name="${{ needs.get-date-release-name.outputs.release_name }}"
release=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/$release_name")
release_id=$(echo $release | jq -r .id)
if [[ "$release_id" == "null" ]]; then
release=$(curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$release_name\",\"name\":\"$release_name\",\"body\":\"Headless raspOVOS\"}" \
"https://api.github.com/repos/${{ github.repository }}/releases")
release_id=$(echo $release | jq -r .id)
fi
echo "release_id=$release_id" >> $GITHUB_OUTPUT
- name: Print outputs
shell: bash
run: |
echo "release_id: ${{ steps.get-release-id.outputs.release_id }}"
if [[ $release_id == "null" ]]; then
echo "Failed to create release. Response: $release"
exit 1
fi
# Stage 4: Upload to Release
upload-image:
runs-on: ubuntu-latest
if: ${{ needs.check-release-or-create.outputs.release_id }}
needs: [ modify-rpi-image, check-release-or-create, get-date-release-name ]
steps:
- name: Restore Cache for Image
uses: actions/cache@v4
with:
path: .
key: ${{ needs.get-date-release-name.outputs.cache_key }}
fail-on-cache-miss: true
- name: Debug Cache Content
run: ls .
- name: Upload to release
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: ${{ needs.modify-rpi-image.outputs.image-path }}
release_id: ${{ needs.check-release-or-create.outputs.release_id }}
draft: false
overwrite: true
prerelease: false
verbose: true
update-en-workflow:
runs-on: ubuntu-latest
needs: [ upload-image, get-date-release-name, modify-rpi-image ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Update base-image-url in build_img_en.yml
run: |
sed -i '/^[^#]*base-image-url:/ {/sed/! s|base-image-url: .*|base-image-url: https://github.com/TigreGotico/raspOVOS/releases/download/${{ needs.get-date-release-name.outputs.release_name }}/${{ needs.modify-rpi-image.outputs.image-path }}|}' .github/workflows/build_img_en.yml
- name: Check for changes
id: check-changes
run: |
if git diff --exit-code .github/workflows/build_img_en.yml; then
echo "base image download url didnt change"
echo "no_changes=true" >> $GITHUB_ENV
else
echo "base image download url updated in build_img_en.yml"
echo "no_changes=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.no_changes == 'false'
uses: peter-evans/create-pull-request@v5
with:
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
token: ${{ secrets.PA_TOKEN }}
branch: "update-base-image-url-en"
commit-message: "Update base-image-url in build_img_en.yml"
title: "Update base-image-url-en"
body: |
This PR updates the base-image-url in `build_img_en.yml` to reflect the latest release.
labels: automated-update
update-ca-workflow:
runs-on: ubuntu-latest
needs: [ upload-image, get-date-release-name, modify-rpi-image ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Update base-image-url in build_img_ca.yml
run: |
sed -i '/^[^#]*base-image-url:/ {/sed/! s|base-image-url: .*|base-image-url: https://github.com/TigreGotico/raspOVOS/releases/download/${{ needs.get-date-release-name.outputs.release_name }}/${{ needs.modify-rpi-image.outputs.image-path }}|}' .github/workflows/build_img_ca.yml
- name: Check for changes
id: check-changes
run: |
if git diff --exit-code .github/workflows/build_img_ca.yml; then
echo "base image download url didnt change"
echo "no_changes=true" >> $GITHUB_ENV
else
echo "base image download url updated in build_img_ca.yml"
echo "no_changes=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.no_changes == 'false'
uses: peter-evans/create-pull-request@v5
with:
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
token: ${{ secrets.PA_TOKEN }}
branch: "update-base-image-url-ca"
commit-message: "Update base-image-url in build_img_ca.yml"
title: "Update base-image-url-ca"
body: |
This PR updates the base-image-url in `build_img_ca.yml` to reflect the latest release.
labels: automated-update
update-pt-workflow:
runs-on: ubuntu-latest
needs: [ upload-image, get-date-release-name, modify-rpi-image ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Update base-image-url in build_img_pt.yml
run: |
sed -i '/^[^#]*base-image-url:/ {/sed/! s|base-image-url: .*|base-image-url: https://github.com/TigreGotico/raspOVOS/releases/download/${{ needs.get-date-release-name.outputs.release_name }}/${{ needs.modify-rpi-image.outputs.image-path }}|}' .github/workflows/build_img_pt.yml
- name: Check for changes
id: check-changes
run: |
if git diff --exit-code .github/workflows/build_img_pt.yml; then
echo "base image download url didnt change"
echo "no_changes=true" >> $GITHUB_ENV
else
echo "base image download url updated in build_img_pt.yml"
echo "no_changes=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.no_changes == 'false'
uses: peter-evans/create-pull-request@v5
with:
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
token: ${{ secrets.PA_TOKEN }}
branch: "update-base-image-url-pt"
commit-message: "Update base-image-url in build_img_pt.yml"
title: "Update base-image-url-pt"
body: |
This PR updates the base-image-url in `build_img_pt.yml` to reflect the latest release.
labels: automated-update
update-gl-workflow:
runs-on: ubuntu-latest
needs: [ upload-image, get-date-release-name, modify-rpi-image ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Update base-image-url in build_img_gl.yml
run: |
sed -i '/^[^#]*base-image-url:/ {/sed/! s|base-image-url: .*|base-image-url: https://github.com/TigreGotico/raspOVOS/releases/download/${{ needs.get-date-release-name.outputs.release_name }}/${{ needs.modify-rpi-image.outputs.image-path }}|}' .github/workflows/build_img_gl.yml
- name: Check for changes
id: check-changes
run: |
if git diff --exit-code .github/workflows/build_img_gl.yml; then
echo "base image download url didnt change"
echo "no_changes=true" >> $GITHUB_ENV
else
echo "base image download url updated in build_img_gl.yml"
echo "no_changes=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.no_changes == 'false'
uses: peter-evans/create-pull-request@v5
with:
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
token: ${{ secrets.PA_TOKEN }}
branch: "update-base-image-url-gl"
commit-message: "Update base-image-url in build_img_gl.yml"
title: "Update base-image-url-gl"
body: |
This PR updates the base-image-url in `build_img_gl.yml` to reflect the latest release.
labels: automated-update
update-eu-workflow:
runs-on: ubuntu-latest
needs: [ upload-image, get-date-release-name, modify-rpi-image ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Update base-image-url in build_img_eu.yml
run: |
sed -i '/^[^#]*base-image-url:/ {/sed/! s|base-image-url: .*|base-image-url: https://github.com/TigreGotico/raspOVOS/releases/download/${{ needs.get-date-release-name.outputs.release_name }}/${{ needs.modify-rpi-image.outputs.image-path }}|}' .github/workflows/build_img_eu.yml
- name: Check for changes
id: check-changes
run: |
if git diff --exit-code .github/workflows/build_img_eu.yml; then
echo "base image download url didnt change"
echo "no_changes=true" >> $GITHUB_ENV
else
echo "base image download url updated in build_img_eu.yml"
echo "no_changes=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.no_changes == 'false'
uses: peter-evans/create-pull-request@v5
with:
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
token: ${{ secrets.PA_TOKEN }}
branch: "update-base-image-url-eu"
commit-message: "Update base-image-url in build_img_eu.yml"
title: "Update base-image-url-eu"
body: |
This PR updates the base-image-url in `build_img_eu.yml` to reflect the latest release.
labels: automated-update
update-es-workflow:
runs-on: ubuntu-latest
needs: [ upload-image, get-date-release-name, modify-rpi-image ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Update base-image-url in build_img_es.yml
run: |
sed -i '/^[^#]*base-image-url:/ {/sed/! s|base-image-url: .*|base-image-url: https://github.com/TigreGotico/raspOVOS/releases/download/${{ needs.get-date-release-name.outputs.release_name }}/${{ needs.modify-rpi-image.outputs.image-path }}|}' .github/workflows/build_img_es.yml
- name: Check for changes
id: check-changes
run: |
if git diff --exit-code .github/workflows/build_img_es.yml; then
echo "base image download url didnt change"
echo "no_changes=true" >> $GITHUB_ENV
else
echo "base image download url updated in build_img_es.yml"
echo "no_changes=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.no_changes == 'false'
uses: peter-evans/create-pull-request@v5
with:
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
token: ${{ secrets.PA_TOKEN }}
branch: "update-base-image-url-es"
commit-message: "Update base-image-url in build_img_es.yml"
title: "Update base-image-url-es"
body: |
This PR updates the base-image-url in `build_img_es.yml` to reflect the latest release.
labels: automated-update
update-nl-workflow:
runs-on: ubuntu-latest
needs: [ upload-image, get-date-release-name, modify-rpi-image ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Update base-image-url in build_img_nl.yml
run: |
sed -i '/^[^#]*base-image-url:/ {/sed/! s|base-image-url: .*|base-image-url: https://github.com/TigreGotico/raspOVOS/releases/download/${{ needs.get-date-release-name.outputs.release_name }}/${{ needs.modify-rpi-image.outputs.image-path }}|}' .github/workflows/build_img_nl.yml
- name: Check for changes
id: check-changes
run: |
if git diff --exit-code .github/workflows/build_img_nl.yml; then
echo "base image download url didnt change"
echo "no_changes=true" >> $GITHUB_ENV
else
echo "base image download url updated in build_img_nl.yml"
echo "no_changes=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.no_changes == 'false'
uses: peter-evans/create-pull-request@v5
with:
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
token: ${{ secrets.PA_TOKEN }}
branch: "update-base-image-url-nl"
commit-message: "Update base-image-url in build_img_nl.yml"
title: "Update base-image-url-nl"
body: |
This PR updates the base-image-url in `build_img_nl.yml` to reflect the latest release.
labels: automated-update
update-de-workflow:
runs-on: ubuntu-latest
needs: [ upload-image, get-date-release-name, modify-rpi-image ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Update base-image-url in build_img_de.yml
run: |
sed -i '/^[^#]*base-image-url:/ {/sed/! s|base-image-url: .*|base-image-url: https://github.com/TigreGotico/raspOVOS/releases/download/${{ needs.get-date-release-name.outputs.release_name }}/${{ needs.modify-rpi-image.outputs.image-path }}|}' .github/workflows/build_img_de.yml
- name: Check for changes
id: check-changes
run: |
if git diff --exit-code .github/workflows/build_img_de.yml; then
echo "base image download url didnt change"
echo "no_changes=true" >> $GITHUB_ENV
else
echo "base image download url updated in build_img_de.yml"
echo "no_changes=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.no_changes == 'false'
uses: peter-evans/create-pull-request@v5
with:
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
token: ${{ secrets.PA_TOKEN }}
branch: "update-base-image-url-de"
commit-message: "Update base-image-url in build_img_de.yml"
title: "Update base-image-url-de"
body: |
This PR updates the base-image-url in `build_img_de.yml` to reflect the latest release.
labels: automated-update
update-gui-workflow:
runs-on: ubuntu-latest
needs: [ upload-image, get-date-release-name, modify-rpi-image ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Update base-image-url in build_img_gui.yml
run: |
sed -i '/^[^#]*base-image-url:/ {/sed/! s|base-image-url: .*|base-image-url: https://github.com/TigreGotico/raspOVOS/releases/download/${{ needs.get-date-release-name.outputs.release_name }}/${{ needs.modify-rpi-image.outputs.image-path }}|}' .github/workflows/build_img_gui.yml
- name: Check for changes
id: check-changes
run: |
if git diff --exit-code .github/workflows/build_img_gui.yml; then
echo "base image download url didnt change"
echo "no_changes=true" >> $GITHUB_ENV
else
echo "base image download url updated in build_img_gui.yml"
echo "no_changes=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.no_changes == 'false'
uses: peter-evans/create-pull-request@v5
with:
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
token: ${{ secrets.PA_TOKEN }}
branch: "update-base-image-url-gui"
commit-message: "Update base-image-url in build_img_gui.yml"
title: "Update base-image-url-gui"
body: |
This PR updates the base-image-url in `build_img_gui.yml` to reflect the latest release.
labels: automated-update