-
Notifications
You must be signed in to change notification settings - Fork 2
415 lines (352 loc) · 13.8 KB
/
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
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
---
name: "Build Gluon images"
# yamllint disable-line rule:truthy
on: [push]
jobs:
build-meta:
outputs:
container-version: >-
${{ steps.build-metadata.outputs.container-version }}
release-version: >-
${{ steps.build-metadata.outputs.release-version }}
autoupdater-enabled: >-
${{ steps.build-metadata.outputs.autoupdater-enabled }}
autoupdater-branch: >-
${{ steps.build-metadata.outputs.autoupdater-branch }}
broken: >-
${{ steps.build-metadata.outputs.broken }}
gluon-repository: >-
${{ steps.build-metadata.outputs.gluon-repository }}
gluon-commit: >-
${{ steps.build-metadata.outputs.gluon-commit }}
manifest-stable: >-
${{ steps.build-metadata.outputs.manifest-stable }}
manifest-beta: >-
${{ steps.build-metadata.outputs.manifest-beta }}
manifest-testing: >-
${{ steps.build-metadata.outputs.manifest-testing }}
sign-manifest: >-
${{ steps.build-metadata.outputs.sign-manifest }}
create-release: >-
${{ steps.build-metadata.outputs.create-release }}
deploy: >-
${{ steps.build-metadata.outputs.deploy }}
target-whitelist: >-
${{ steps.build-metadata.outputs.target-whitelist }}
runs-on: ubuntu-latest
name: Determine build-meta
steps:
- uses: actions/checkout@v4
- name: Get build-metadata
id: build-metadata
run: bash .github/build-meta.sh
- name: Create Artifact of build-meta
uses: actions/upload-artifact@v3
with:
name: build-meta
path: ${{ steps.build-metadata.outputs.build-meta-output }}
targets:
needs: build-meta
outputs:
targets: ${{ steps.get-targets.outputs.targets }}
runs-on: ubuntu-latest
name: Get Gluon targets
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: ${{ needs.build-meta.outputs.gluon-repository }}
ref: ${{ needs.build-meta.outputs.gluon-commit }}
path: 'gluon-gha-data/gluon'
- name: Get Targets
uses: freifunk-gluon/action-target-list@v1
id: get-targets
with:
gluon-path: "gluon-gha-data/gluon"
broken: ${{ needs.build-meta.outputs.broken }}
allowlist: ${{ needs.build-meta.outputs.target-whitelist }}
host-tools:
needs: build-meta
runs-on: ubuntu-latest
name: Build host-tools
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: ${{ needs.build-meta.outputs.gluon-repository }}
ref: ${{ needs.build-meta.outputs.gluon-commit }}
path: 'gluon-gha-data/gluon'
- name: Determine Cache-Key
id: cache-key
run: >
echo "cache-key=$(bash .github/cache-key.sh
$GITHUB_WORKSPACE/gluon-gha-data/gluon)" >> "$GITHUB_OUTPUT"
- name: Restore Cache
id: restore-cache-tools
uses: actions/cache/restore@v3
with:
path: gluon-gha-data/gluon/openwrt
key: openwrt-${{ steps.cache-key.outputs.cache-key }}
- name: Update Gluon
uses: freifunk-gluon/action-build@v1
if: steps.restore-cache-tools.outputs.cache-hit != 'true'
id: update-gluon
with:
container-version: ${{ needs.build-meta.outputs.container-version }}
gluon-path: "gluon-gha-data/gluon"
make-target: update
site-path: "."
- name: Build host-tools
uses: freifunk-gluon/action-build@v1
if: steps.restore-cache-tools.outputs.cache-hit != 'true'
id: build-host-tools
with:
container-version: ${{ needs.build-meta.outputs.container-version }}
gluon-path: "gluon-gha-data/gluon"
make-target: openwrt/staging_dir/hostpkg/bin/lua
site-path: "."
- name: Save Cache
id: save-cache-tools
if: >
github.ref_type != 'tag' &&
steps.restore-cache-tools.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: gluon-gha-data/gluon/openwrt
key: openwrt-${{ steps.cache-key.outputs.cache-key }}
- name: Create Artifact output directory
run: mkdir gluon-gha-data/openwrt
- name: Pack Output
run: >
tar cJf "gluon-gha-data/openwrt/openwrt.tar.xz"
--posix -C "gluon-gha-data/gluon" openwrt
- name: Archive build output
uses: actions/upload-artifact@v3
with:
name: openwrt
path: "gluon-gha-data/openwrt"
build:
needs: [targets, build-meta, host-tools]
if: ${{ needs.targets.outputs.targets != '[]' }}
strategy:
fail-fast: false
matrix:
target: ${{ fromJSON(needs.targets.outputs.targets) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: ${{ needs.build-meta.outputs.gluon-repository }}
ref: ${{ needs.build-meta.outputs.gluon-commit }}
path: 'gluon-gha-data/gluon'
fetch-depth: 0
fetch-tags: true
- name: Print CPU info
run: cat /proc/cpuinfo
- name: Print meminfo
run: cat /proc/meminfo
- name: Download prepared OpenWrt
uses: actions/download-artifact@v3
with:
name: openwrt
path: "gluon-gha-data/openwrt"
- name: Restore OpenWrt
run: >
tar xf gluon-gha-data/openwrt/openwrt.tar.xz -C gluon-gha-data/gluon
- name: Gluon Update
uses: freifunk-gluon/action-build@v1
id: update-gluon
with:
container-version: ${{ needs.build-meta.outputs.container-version }}
gluon-path: "gluon-gha-data/gluon"
hardware-target: ath79-generic
make-target: update
- name: Build
uses: freifunk-gluon/action-build@v1
id: build-gluon
with:
container-version: ${{ needs.build-meta.outputs.container-version }}
gluon-path: "gluon-gha-data/gluon"
hardware-target: ${{ matrix.target }}
broken: ${{ needs.build-meta.outputs.broken }}
deprecated: "0"
autoupdater-enabled: |
${{ needs.build-meta.outputs.autoupdater-enabled }}
autoupdater-branch: |
${{ needs.build-meta.outputs.autoupdater-branch }}
release: ${{ needs.build-meta.outputs.release-version }}
- name: Pack and Upload build output
uses: ./.github/actions/build-artifact
with:
gluon-path: "gluon-gha-data/gluon"
hardware-target: ${{ matrix.target }}
manifest:
needs: [build, build-meta, targets]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
path: "gluon-gha-data/gluon-output"
- name: Clone Gluon
uses: actions/checkout@v4
with:
repository: ${{ needs.build-meta.outputs.gluon-repository }}
ref: ${{ needs.build-meta.outputs.gluon-commit }}
path: 'gluon-gha-data/gluon'
- name: Download prepared OpenWrt
uses: actions/download-artifact@v3
with:
name: openwrt
path: "gluon-gha-data/openwrt"
- name: Restore OpenWrt
run: |
tar xf gluon-gha-data/openwrt/openwrt.tar.xz -C gluon-gha-data/gluon
- name: Combine Build output
uses: ./.github/actions/build-combine
with:
artifact-dir: "gluon-gha-data/gluon-output"
output-dir: "gluon-gha-data/gluon/output"
targets: ${{ needs.targets.outputs.targets }}
- name: Gluon Update
uses: freifunk-gluon/action-build@v1
id: update-gluon
with:
container-version: ${{ needs.build-meta.outputs.container-version }}
gluon-path: "gluon-gha-data/gluon"
make-target: update
- name: Manifest (Stable)
uses: freifunk-gluon/action-build@v1
if: ${{ needs.build-meta.outputs.manifest-stable != '0' }}
with:
container-version: ${{ needs.build-meta.outputs.container-version }}
gluon-path: "gluon-gha-data/gluon"
make-target: manifest
autoupdater-branch: stable
release: ${{ needs.build-meta.outputs.release-version }}
priority: 1
- name: Manifest (Beta)
uses: freifunk-gluon/action-build@v1
if: ${{ needs.build-meta.outputs.manifest-beta != '0' }}
with:
container-version: |
${{ needs.build-meta.outputs.container-version }}
gluon-path: "gluon-gha-data/gluon"
make-target: manifest
autoupdater-branch: beta
release: |
${{ needs.build-meta.outputs.release-version }}
priority: 1
- name: Manifest (Testing)
uses: freifunk-gluon/action-build@v1
if: ${{ needs.build-meta.outputs.manifest-testing != '0' }}
with:
container-version: ${{ needs.build-meta.outputs.container-version }}
gluon-path: "gluon-gha-data/gluon"
make-target: manifest
autoupdater-branch: testing
release: ${{ needs.build-meta.outputs.release-version }}
priority: 1
- name: Sign manifest (Testing)
uses: freifunk-gluon/action-sign@v1
if: >
needs.build-meta.outputs.manifest-testing != '0' &&
needs.build-meta.outputs.sign-manifest != '0'
with:
container-version: ${{ needs.build-meta.outputs.container-version }}
gluon-path: "gluon-gha-data/gluon"
manifest: >-
gluon-gha-data/gluon/output/images/sysupgrade/testing.manifest
signing-key: ${{ secrets.GHA_FFDA_BUILD_ECDSA_KEY_TESTING }}
write-signature: "true"
- name: Create Artifact Directory
run: mkdir gluon-gha-data/artifact-out
- name: Structure
run: tree gluon-gha-data/gluon
- name: Pack Manifest
run: >
find ./gluon-gha-data/gluon/output/images/sysupgrade
-maxdepth 1 -name "*.manifest" -exec basename {} \; |
tar cJf gluon-gha-data/artifact-out/manifest.tar.xz
-C gluon-gha-data/gluon/output/images/sysupgrade -T -
- name: Archive output
uses: actions/upload-artifact@v3
with:
name: manifest-signed
path: gluon-gha-data/artifact-out
deploy:
needs: [build, build-meta, targets, manifest]
runs-on: ubuntu-latest
if: ${{ needs.build-meta.outputs.deploy != '0' }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
path: "gluon-gha-data/artifact-download"
- name: Create Directory to store Gluon output into
run: mkdir gluon-gha-data/gluon-output
- name: Combine Build output
uses: ./.github/actions/build-combine
with:
artifact-dir: "gluon-gha-data/artifact-download"
output-dir: "gluon-gha-data/gluon-output/output"
targets: ${{ needs.targets.outputs.targets }}
- name: Extract Manifest
run: >
tar xf
gluon-gha-data/artifact-download/manifest-signed/manifest.tar.xz
-C gluon-gha-data/gluon-output/output/images/sysupgrade
- name: Save SSH Key for deployment
run: >
mkdir -p ~/.ssh &&
echo "${{ secrets.GHA_FFDA_BUILD_DEPLOY_SSH_KEY }}" >
~/.ssh/deploy_key && chmod 600 ~/.ssh/deploy_key
- name: Deploy Images
# yamllint disable-line rule:line-length
run: rsync -avzP -e "ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key -oIdentitiesOnly=yes" gluon-gha-data/gluon-output/output/images/{factory,sysupgrade,other} "firmware@www1.darmstadt.freifunk.net:/srv/firmware/images/${{ needs.build-meta.outputs.release-version }}/"
- name: Deploy Packages
# ToDo: Remove 'ffda' site-code and move to build-meta
# yamllint disable-line rule:line-length
run: rsync -avzP -e "ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key -oIdentitiesOnly=yes" "gluon-gha-data/gluon-output/output/packages/gluon-ffda-${{ needs.build-meta.outputs.release-version }}" "firmware@www1.darmstadt.freifunk.net:/srv/firmware/modules/"
create-release:
needs: [build, build-meta, targets, manifest]
runs-on: ubuntu-latest
if: ${{ needs.build-meta.outputs.create-release != '0' }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
path: "gluon-gha-data/artifact-download"
- name: Create Directory to store Gluon output into
run: mkdir gluon-gha-data/gluon-output
- name: Download target Artifacts
uses: ./.github/actions/build-combine
with:
artifact-dir: "gluon-gha-data/artifact-download"
output-dir: "gluon-gha-data/release-artifacts"
targets: ${{ needs.targets.outputs.targets }}
keep-packed: 1
- name: Move manifest archive
run: >-
mv gluon-gha-data/artifact-download/manifest-signed/manifest.tar.xz
gluon-gha-data/release-artifacts/manifest.tar.xz
- name: Move manifest archive
run: >-
mv gluon-gha-data/artifact-download/build-meta/build-meta.txt
gluon-gha-data/release-artifacts/build-meta.txt
- name: Show File sizes
run: du -sh gluon-gha-data/release-artifacts/*
- name: Create Release Notes
run: >-
bash .github/create-release-notes.sh
gluon-gha-data/release-artifacts/build-meta.txt
gluon-gha-data/release-notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
body_path: gluon-gha-data/release-notes.md
files: |
gluon-gha-data/release-artifacts/*