forked from armbian/build
-
Notifications
You must be signed in to change notification settings - Fork 0
391 lines (322 loc) · 12.5 KB
/
build-images.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
name: Build Images
#
# Generates beta, stable or RC images. You can select build runners. By default it generates all images, but you can build images only for one target
# Images are placed at www.arnmbian.com and nighly beta also at https://github.com/armbian/build/releases/tag/latest
#
on:
workflow_run:
workflows: ["Build train"]
types:
- completed
workflow_dispatch:
inputs:
choice:
type: choice
description: Build targets
options:
- beta
- stable
- rc
runner:
type: choice
description: Build runners for CLI
options:
- small
- ubuntu-latest
sourcerepo:
description: Source repository
required: false
default: 'nightly'
packagesrepo:
type: choice
description: Beta packages repository
options:
- "yes"
- "no"
advanced:
description: 'Single board (grep -w tinkerboard |)'
required: false
default: ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
Cancel:
if: ${{ github.repository_owner == 'Armbian' && github.event.schedule == '' }}
name: "Cancel currently active"
runs-on: small
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
clean:
if: ${{ github.repository_owner == 'Armbian' }}
name: Purge older releases
needs: [ Cancel ]
runs-on: [ubuntu-latest]
steps:
- name: Purge
uses: dev-drprasad/[email protected]
with:
keep_latest: 7
delete_tag_pattern: trunk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: igorjs/gh-actions-clean-workflow@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
days_old: 14
fake:
if: ${{ github.repository_owner == 'Armbian' }}
runs-on: small
needs: [ clean ]
name: Source changes
outputs:
changes: ${{steps.list_releases.outputs.changes}}
version: ${{steps.list_releases.outputs.version}}
steps:
- run: |
echo "not empty" > changes
- uses: actions/checkout@v3
if: ${{ github.repository_owner == 'Armbian' && github.event.inputs.choice != 'stable' && github.event.inputs.choice != 'rc' }}
with:
fetch-depth: 1
path: build
clean: false
ref: nightly
- name: "Get latest release version"
if: ${{ github.repository_owner == 'Armbian' && github.event.inputs.choice != 'stable' && github.event.inputs.choice != 'rc' }}
id: list_releases
run: |
RELE=$(curl -ks https://api.github.com/repos/armbian/build/releases/latest ^| grep "browser_download_url" | grep -o -P '(?<=Armbian.).*(?=_)' | cut -d"_" -f1 | sort | uniq | head -1)
SOUR=$(cat build/VERSION)
# skip if version in git is the same as at release
if [[ "$RELE" == "$SOUR" ]]; then
echo ::set-output name=changes::$(echo 'true')
fi
# output version
echo ::set-output name=version::$(echo ${SOUR})
- uses: actions/upload-artifact@v3
with:
path: changes
name: changes
if-no-files-found: ignore
- uses: actions/upload-artifact@v3
with:
path: changes
name: changes
if-no-files-found: ignore
generaterelease:
needs: [ fake ]
if: ${{ github.repository_owner == 'Armbian' && needs.fake.outputs.changes != 'true' }}
runs-on: ubuntu-latest
name: "Update latest release"
steps:
- run: |
echo "Env: ${{ github.event.inputs.choice }}"
echo "Env: ${{ github.event.inputs.runner }}"
echo "Env: ${{ github.event.inputs.sourcerepo }}"
echo "Branch: ${{ github.event.inputs.branch }}"
echo "Version: ${{ needs.fake.outputs.version }}"
- uses: actions/checkout@v3
if: ${{ github.repository_owner == 'Armbian' && github.event.inputs.choice != 'stable' && github.event.inputs.choice != 'rc' }}
with:
fetch-depth: 1
- uses: dev-drprasad/[email protected]
if: ${{ github.repository_owner == 'Armbian' && github.event.inputs.choice != 'stable' && github.event.inputs.choice != 'rc' }}
with:
delete_release: true
tag_name: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ncipollo/release-action@v1
if: ${{ github.repository_owner == 'Armbian' && github.event.inputs.choice != 'stable' && github.event.inputs.choice != 'rc' }}
with:
artifacts: "LICENSE"
tag: "${{ needs.fake.outputs.version }}"
name: "Build in progress"
bodyFile: ".github/Releases-wip.md"
allowUpdates: true
removeArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
merge:
needs: [ generaterelease ]
uses: armbian/scripts/.github/workflows/merge-from-branch.yml@master
with:
branch: 'nightly'
runner: small
secrets:
GPG_KEY2: ${{ secrets.GPG_KEY2 }}
GPG_PASSPHRASE2: ${{ secrets.GPG_PASSPHRASE2 }}
x86:
needs: [ merge ]
uses: armbian/scripts/.github/workflows/build-with-docker.yml@master
with:
variant: 'cli:${{ github.event.inputs.choice }}'
sourcerepo: '${{ github.event.inputs.sourcerepo }}'
packagesrepo: '${{ github.event.inputs.packagesrepo }}'
runner: ubuntu-latest
part: 1
of: 1
include: 'grep uefi-x86 | ${{ github.event.inputs.advanced }}'
exclude: ''
uploading: false
secrets:
GPG_KEY1: ${{ secrets.GPG_KEY1 }}
GPG_PASSPHRASE1: ${{ secrets.GPG_PASSPHRASE1 }}
GPG_KEY2: ${{ secrets.GPG_KEY2 }}
GPG_PASSPHRASE2: ${{ secrets.GPG_PASSPHRASE2 }}
SCRIPTS_ACCESS_TOKEN: ${{ secrets.SCRIPTS_ACCESS_TOKEN }}
SSH_KEY_TORRENTS: ${{ secrets.KEY_TORRENTS }}
KNOWN_HOSTS_UPLOAD: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
x86-desktop:
needs: [ merge ]
uses: armbian/scripts/.github/workflows/build-with-docker.yml@master
with:
variant: 'desktop:${{ github.event.inputs.choice }}'
sourcerepo: '${{ github.event.inputs.sourcerepo }}'
packagesrepo: '${{ github.event.inputs.packagesrepo }}'
runner: "big"
part: 1
of: 1
include: 'grep uefi-x86 | ${{ github.event.inputs.advanced }}'
exclude: ''
uploading: false
secrets:
GPG_KEY1: ${{ secrets.GPG_KEY1 }}
GPG_PASSPHRASE1: ${{ secrets.GPG_PASSPHRASE1 }}
GPG_KEY2: ${{ secrets.GPG_KEY2 }}
GPG_PASSPHRASE2: ${{ secrets.GPG_PASSPHRASE2 }}
SCRIPTS_ACCESS_TOKEN: ${{ secrets.SCRIPTS_ACCESS_TOKEN }}
SSH_KEY_TORRENTS: ${{ secrets.KEY_TORRENTS }}
KNOWN_HOSTS_UPLOAD: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
cli1:
needs: [ merge ]
uses: armbian/scripts/.github/workflows/build-with-docker.yml@master
with:
variant: 'cli:${{ github.event.inputs.choice }}'
sourcerepo: '${{ github.event.inputs.sourcerepo }}'
packagesrepo: '${{ github.event.inputs.packagesrepo }}'
runner: ubuntu-latest
part: 1
of: 2
include: '${{ github.event.inputs.advanced }}'
exclude: 'grep -v uefi-x86 | '
uploading: false
secrets:
GPG_KEY1: ${{ secrets.GPG_KEY1 }}
GPG_PASSPHRASE1: ${{ secrets.GPG_PASSPHRASE1 }}
GPG_KEY2: ${{ secrets.GPG_KEY2 }}
GPG_PASSPHRASE2: ${{ secrets.GPG_PASSPHRASE2 }}
SCRIPTS_ACCESS_TOKEN: ${{ secrets.SCRIPTS_ACCESS_TOKEN }}
SSH_KEY_TORRENTS: ${{ secrets.KEY_TORRENTS }}
KNOWN_HOSTS_UPLOAD: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
cli2:
needs: [ merge ]
uses: armbian/scripts/.github/workflows/build-with-docker.yml@master
with:
variant: 'cli:${{ github.event.inputs.choice }}'
sourcerepo: '${{ github.event.inputs.sourcerepo }}'
packagesrepo: '${{ github.event.inputs.packagesrepo }}'
runner: '${{ github.event.inputs.runner }}'
part: 2
of: 2
include: '${{ github.event.inputs.advanced }}'
exclude: 'grep -v uefi-x86 | '
uploading: false
secrets:
GPG_KEY1: ${{ secrets.GPG_KEY1 }}
GPG_PASSPHRASE1: ${{ secrets.GPG_PASSPHRASE1 }}
GPG_KEY2: ${{ secrets.GPG_KEY2 }}
GPG_PASSPHRASE2: ${{ secrets.GPG_PASSPHRASE2 }}
SCRIPTS_ACCESS_TOKEN: ${{ secrets.SCRIPTS_ACCESS_TOKEN }}
SSH_KEY_TORRENTS: ${{ secrets.KEY_TORRENTS }}
KNOWN_HOSTS_UPLOAD: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
desktop1:
needs: [ merge ]
uses: armbian/scripts/.github/workflows/build-with-docker.yml@master
with:
variant: 'desktop:${{ github.event.inputs.choice }}'
sourcerepo: '${{ github.event.inputs.sourcerepo }}'
packagesrepo: '${{ github.event.inputs.packagesrepo }}'
runner: "big"
part: 1
of: 2
include: '${{ github.event.inputs.advanced }}'
exclude: 'grep -v uefi-x86 | '
uploading: false
secrets:
GPG_KEY1: ${{ secrets.GPG_KEY1 }}
GPG_PASSPHRASE1: ${{ secrets.GPG_PASSPHRASE1 }}
GPG_KEY2: ${{ secrets.GPG_KEY2 }}
GPG_PASSPHRASE2: ${{ secrets.GPG_PASSPHRASE2 }}
SCRIPTS_ACCESS_TOKEN: ${{ secrets.SCRIPTS_ACCESS_TOKEN }}
SSH_KEY_TORRENTS: ${{ secrets.KEY_TORRENTS }}
KNOWN_HOSTS_UPLOAD: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
desktop2:
needs: [ merge ]
uses: armbian/scripts/.github/workflows/build-with-docker.yml@master
with:
variant: 'desktop:${{ github.event.inputs.choice }}'
sourcerepo: '${{ github.event.inputs.sourcerepo }}'
packagesrepo: '${{ github.event.inputs.packagesrepo }}'
runner: "big"
part: 2
of: 2
include: '${{ github.event.inputs.advanced }}'
exclude: 'grep -v uefi-x86 | '
uploading: false
secrets:
GPG_KEY1: ${{ secrets.GPG_KEY1 }}
GPG_PASSPHRASE1: ${{ secrets.GPG_PASSPHRASE1 }}
GPG_KEY2: ${{ secrets.GPG_KEY2 }}
GPG_PASSPHRASE2: ${{ secrets.GPG_PASSPHRASE2 }}
SCRIPTS_ACCESS_TOKEN: ${{ secrets.SCRIPTS_ACCESS_TOKEN }}
SSH_KEY_TORRENTS: ${{ secrets.KEY_TORRENTS }}
KNOWN_HOSTS_UPLOAD: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
jobsend:
name: finish
needs: [x86,x86-desktop,cli1,desktop1,cli2,desktop2]
runs-on: [ubuntu-latest]
if: ${{ github.repository_owner == 'Armbian' && github.event.inputs.choice != 'stable' && github.event.inputs.choice != 'rc' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
ref: nightly
- name: Make build list
run: |
sudo npm install --location=global json || true
truncate README.me --size=0 || true
echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
cat ".github/Releases.md" >> README.tmp
echo -en " \n\n" >> README.tmp
echo "| Image | GPG | SHA | Release | Branch | Variant | Size | Kernel |" >> README.tmp
echo "| --- | :--: | :--: | :--: | :--: | :--: | --: | --: |" >> README.tmp
gh release view --json assets 2>/dev/null | python3 -mjson.tool | sed '1,2d;$d' | json -ga name url size -d, | sort | (
while read -r line; do
name=$(echo $line | cut -d"," -f1 | awk '{print tolower($0)}')
url=$(echo $line | cut -d"," -f2)
size=$(echo $line | cut -d"," -f3)
if [ "${name: -3}" == ".xz" ]; then
board_name=$(echo $name | cut -d"_" -f3)
source config/boards/$board_name.*
out_release=$(echo $name | cut -d"_" -f4)
out_branch=$(echo $name | cut -d"_" -f5)
out_kernel=$(echo $name | cut -d"_" -f6-7 | cut -d"." -f1-3 | cut -d"_" -f1)
out_desktop=$(echo $name | cut -d"_" -f7)
out_desktop=${out_desktop:-cli}
out_size=$(echo "scale=2; $size/1024/1024" | bc -l)" Mb"
echo -ne "| [$BOARD_NAME]($url) | [:file_folder:]($url".asc") | [:file_folder:]($url".sha") | $out_release | $out_branch | $out_desktop | $out_size | $out_kernel |\n" >> README.tmp
fi
done
)
cat README.tmp
- uses: ncipollo/release-action@v1
with:
tag: "${{ env.VERSION }}"
bodyFile: "README.tmp"
name: "Armbian ${{ env.VERSION }}"
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}