-
Notifications
You must be signed in to change notification settings - Fork 0
488 lines (436 loc) · 21.1 KB
/
Copy pathrelease-build-manual.yml
File metadata and controls
488 lines (436 loc) · 21.1 KB
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
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
name: Build DDNSTO Packages (Manual)
on:
workflow_dispatch:
inputs:
build_type:
description: '包格式'
required: true
default: 'all'
type: choice
options:
- all
- apk_only
- ipk_only
ddnsto_type:
description: 'DDNSTO 类型'
required: true
default: 'all'
type: choice
options:
- standard
- lite
- all
arch_aarch64:
description: 'aarch64_generic'
required: true
default: true
type: boolean
arch_arm:
description: 'arm_cortex-a9'
required: true
default: true
type: boolean
arch_x86_64:
description: 'x86_64'
required: true
default: true
type: boolean
arch_mipsel:
description: 'mipsel_24kc'
required: true
default: true
type: boolean
push:
tags:
- 'v*'
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.setup.outputs.matrix }}
ddnsto_type: ${{ steps.setup.outputs.ddnsto_type }}
ddnsto_types: ${{ steps.setup.outputs.ddnsto_types }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup matrix
id: setup
run: |
# SDK配置映射 - 使用官方镜像
declare -A SDK_URLS
SDK_URLS[aarch64_generic]="https://downloads.openwrt.org/releases/24.10.2/targets/armsr/armv8/openwrt-sdk-24.10.2-armsr-armv8_gcc-13.3.0_musl.Linux-x86_64.tar.zst"
SDK_URLS[arm_cortex-a9]="https://downloads.openwrt.org/releases/24.10.2/targets/mvebu/cortexa9/openwrt-sdk-24.10.2-mvebu-cortexa9_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst"
SDK_URLS[x86_64]="https://downloads.openwrt.org/releases/24.10.2/targets/x86/64/openwrt-sdk-24.10.2-x86-64_gcc-13.3.0_musl.Linux-x86_64.tar.zst"
SDK_URLS[mipsel_24kc]="https://downloads.openwrt.org/releases/24.10.2/targets/ramips/mt7621/openwrt-sdk-24.10.2-ramips-mt7621_gcc-13.3.0_musl.Linux-x86_64.tar.zst"
# 构建矩阵JSON
matrix="["
first=true
if [ "${{ github.event_name }}" == "push" ]; then
# push事件构建全部
for arch in aarch64_generic arm_cortex-a9 x86_64 mipsel_24kc; do
if [ "$first" == "false" ]; then matrix="$matrix,"; fi
matrix="$matrix{\"arch\":\"$arch\",\"sdk_url\":\"${SDK_URLS[$arch]}\"}"
first=false
done
echo 'ddnsto_type=standard' >> $GITHUB_OUTPUT
echo 'ddnsto_types=["standard"]' >> $GITHUB_OUTPUT
else
# 手动触发时根据选择构建
if [ "${{ github.event.inputs.arch_aarch64 }}" == "true" ]; then
if [ "$first" == "false" ]; then matrix="$matrix,"; fi
matrix="$matrix{\"arch\":\"aarch64_generic\",\"sdk_url\":\"${SDK_URLS[aarch64_generic]}\"}"
first=false
fi
if [ "${{ github.event.inputs.arch_arm }}" == "true" ]; then
if [ "$first" == "false" ]; then matrix="$matrix,"; fi
matrix="$matrix{\"arch\":\"arm_cortex-a9\",\"sdk_url\":\"${SDK_URLS[arm_cortex-a9]}\"}"
first=false
fi
if [ "${{ github.event.inputs.arch_x86_64 }}" == "true" ]; then
if [ "$first" == "false" ]; then matrix="$matrix,"; fi
matrix="$matrix{\"arch\":\"x86_64\",\"sdk_url\":\"${SDK_URLS[x86_64]}\"}"
first=false
fi
if [ "${{ github.event.inputs.arch_mipsel }}" == "true" ]; then
if [ "$first" == "false" ]; then matrix="$matrix,"; fi
matrix="$matrix{\"arch\":\"mipsel_24kc\",\"sdk_url\":\"${SDK_URLS[mipsel_24kc]}\"}"
first=false
fi
# 如果没有选择任何架构,默认构建全部
if [ "$first" == "true" ]; then
for arch in aarch64_generic arm_cortex-a9 x86_64 mipsel_24kc; do
if [ "$first" == "false" ]; then matrix="$matrix,"; fi
matrix="$matrix{\"arch\":\"$arch\",\"sdk_url\":\"${SDK_URLS[$arch]}\"}"
first=false
done
fi
# 处理 ddnsto_type,all 表示同时编译 standard 和 lite
DDNSTO_TYPE="${{ github.event.inputs.ddnsto_type }}"
if [ "$DDNSTO_TYPE" == "all" ]; then
echo 'ddnsto_type=standard' >> $GITHUB_OUTPUT
echo 'ddnsto_types=["standard","lite"]' >> $GITHUB_OUTPUT
else
echo "ddnsto_type=$DDNSTO_TYPE" >> $GITHUB_OUTPUT
echo "ddnsto_types=[\"$DDNSTO_TYPE\"]" >> $GITHUB_OUTPUT
fi
fi
matrix="$matrix]"
echo "matrix=$matrix" >> $GITHUB_OUTPUT
echo "Matrix: $matrix"
build-ipk:
name: Build IPK ${{ matrix.arch_info.arch }} (${{ matrix.ddnsto_type }})
runs-on: ubuntu-latest
needs: setup
if: github.event.inputs.build_type == 'ipk_only' || github.event.inputs.build_type == 'all' || github.event_name == 'push'
strategy:
fail-fast: false
matrix:
arch_info: ${{ fromJson(needs.setup.outputs.matrix) }}
ddnsto_type: ${{ fromJson(needs.setup.outputs.ddnsto_types) }}
env:
DDNSTO_TYPE: ${{ matrix.ddnsto_type }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup variables
run: |
sudo timedatectl set-timezone 'Asia/Shanghai'
echo build_time="$(date '+%Y-%m-%d')" >> "$GITHUB_ENV"
- name: Cache SDK
id: cache-sdk
uses: actions/cache@v4
with:
path: ~/sdk
key: openwrt-sdk-24.10.2-${{ matrix.arch_info.arch }}-${{ matrix.ddnsto_type }}-${{ hashFiles('ddnsto/Makefile') }}-v3
restore-keys: |
openwrt-sdk-24.10.2-${{ matrix.arch_info.arch }}-${{ matrix.ddnsto_type }}-v3
- name: Download SDK
if: steps.cache-sdk.outputs.cache-hit != 'true'
run: |
mkdir -p ~/sdk
echo "Downloading SDK from ${{ matrix.arch_info.sdk_url }}"
wget -q --show-progress -O ~/sdk/sdk.tar.zst "${{ matrix.arch_info.sdk_url }}"
echo "Extracting SDK..."
cd ~/sdk && tar -xf sdk.tar.zst --strip-components=1 && rm sdk.tar.zst
- name: Setup SDK
run: |
cd ~/sdk
# 安装主机编译依赖
sudo apt-get update
sudo apt-get install -y libncurses5-dev libncursesw5-dev
./scripts/feeds update -a || true
# 删除 u-boot-mediatek 包,避免 python3-setuptools 检测失败
rm -rf feeds/base/package/boot/uboot-mediatek
./scripts/feeds install -a || true
- name: Build Package
run: |
cd ~/sdk
# 清理旧的 ddnsto 构建目录和下载文件,确保完全重新编译
# 必须删除整个构建目录和下载文件,因为哈希值可能不匹配
# 注意:lite和standard使用不同的构建目录
echo "=== Cleaning old build directories and downloads ==="
rm -rf build_dir/target-*/ddnsto-binary*
rm -rf build_dir/target-*/.ddnsto-binary*
rm -f dl/ddnsto-binary*.tar.gz
rm -f dl/ddnsto-binary*.tar.gz.flock
rm -rf staging_dir/packages/*/ddnsto*
find bin/packages/ -name "ddnsto*.ipk" -delete 2>/dev/null || true
# 直接复制包到package目录(不使用feeds机制)
rm -rf package/ddnsto
mkdir -p package/ddnsto
cp -r $GITHUB_WORKSPACE/ddnsto/* package/ddnsto/
echo "=== Package directory contents ==="
ls -la package/ddnsto/
# 配置
echo "CONFIG_PACKAGE_ddnsto=m" >> .config
make defconfig
# 构建前检查
echo "=== Pre-build check ==="
echo "DDNSTO_TYPE=$DDNSTO_TYPE"
ls -la build_dir/target-*/ddnsto-binary* 2>/dev/null || echo "No existing ddnsto build dir"
# 构建 - 使用详细输出
echo "=== Starting build with DDNSTO_TYPE=$DDNSTO_TYPE ==="
make package/ddnsto/compile V=sc -j1 2>&1 | tee build.log || {
echo "=== DDNSTO BUILD FAILED ==="
tail -100 build.log
exit 1
}
# 验证下载的二进制文件
echo "=== Verifying downloaded binary ==="
ls -la dl/ddnsto-binary*.tar.gz 2>/dev/null || echo "No tar.gz in dl"
if [ -f dl/ddnsto-binary-3.1.7.tar.gz ]; then
echo "Contents of standard tar.gz:"
tar -tzf dl/ddnsto-binary-3.1.7.tar.gz
echo "SHA256 of downloaded tar.gz:"
sha256sum dl/ddnsto-binary-3.1.7.tar.gz
echo "SHA256 of binaries inside standard tar.gz:"
tar -Oxf dl/ddnsto-binary-3.1.7.tar.gz ddnsto-binary-3.1.7/ddnsto.x86_64 2>/dev/null | sha256sum || echo "Cannot extract x86_64"
tar -Oxf dl/ddnsto-binary-3.1.7.tar.gz ddnsto-binary-3.1.7/ddnsto.aarch64 2>/dev/null | sha256sum || echo "Cannot extract aarch64"
fi
if [ -f dl/ddnsto-binary-lite-3.1.7.tar.gz ]; then
echo "Contents of lite tar.gz:"
tar -tzf dl/ddnsto-binary-lite-3.1.7.tar.gz
echo "SHA256 of downloaded lite tar.gz:"
sha256sum dl/ddnsto-binary-lite-3.1.7.tar.gz
echo "SHA256 of binaries inside lite tar.gz:"
tar -Oxf dl/ddnsto-binary-lite-3.1.7.tar.gz ddnsto-binary-lite-3.1.7/ddnsto.x86_64 2>/dev/null | sha256sum || echo "Cannot extract x86_64"
tar -Oxf dl/ddnsto-binary-lite-3.1.7.tar.gz ddnsto-binary-lite-3.1.7/ddnsto.aarch64 2>/dev/null | sha256sum || echo "Cannot extract aarch64"
fi
echo "Directory structure of build_dir:"
find build_dir/target-*/ddnsto-binary*/ -type d 2>/dev/null | head -20
echo "Files in build_dir:"
find build_dir/target-*/ddnsto-binary*/ -type f -ls 2>/dev/null || echo "No files found"
echo "SHA256 of ddnstod in .pkgdir:"
find build_dir/target-*/ddnsto-binary*/ -name "ddnstod" -type f -exec sha256sum {} \; 2>/dev/null || echo "No ddnstod found"
echo "SHA256 of ddnsto.* binaries in build_dir:"
find build_dir/target-*/ddnsto-binary*/ -name "ddnsto.*" -type f -exec sha256sum {} \; 2>/dev/null || echo "No ddnsto.* found"
echo "=== Post-build check ==="
ls -la build_dir/target-*/ddnsto-binary*/ 2>/dev/null || echo "Build dir not found"
find bin/packages/ -name "ddnsto*.ipk" 2>/dev/null || echo "No IPK found"
# 检查 IPK 文件中的二进制哈希
echo "=== Checking IPK content ==="
for ipk in $(find bin/packages/ -name "ddnsto*.ipk" 2>/dev/null); do
echo "IPK file: $ipk"
echo "File type:"
file "$ipk"
# IPK 文件是 tar.gz 格式,包含 debian-binary, control.tar.gz, data.tar.gz
rm -rf /tmp/ipk_check
mkdir -p /tmp/ipk_check
# 使用绝对路径解压
tar -xzf "$PWD/$ipk" -C /tmp/ipk_check 2>/dev/null || echo "Cannot extract IPK outer tar"
ls -la /tmp/ipk_check/
if [ -f "/tmp/ipk_check/data.tar.gz" ]; then
echo "Contents of data.tar.gz:"
tar -tzf /tmp/ipk_check/data.tar.gz | grep -E "(ddnsto|sbin)" || echo "No ddnsto in data.tar.gz"
echo "SHA256 of ddnstod in data.tar.gz:"
tar -Oxf /tmp/ipk_check/data.tar.gz ./usr/sbin/ddnstod 2>/dev/null | sha256sum || echo "Cannot extract ddnstod"
fi
rm -rf /tmp/ipk_check
done
# 复制输出
mkdir -p $GITHUB_WORKSPACE/bin/packages/${{ matrix.arch_info.arch }}/packages_ci
find bin/packages/ -name "ddnsto*.ipk" -exec cp {} $GITHUB_WORKSPACE/bin/packages/${{ matrix.arch_info.arch }}/packages_ci/ \;
echo "=== Final packages ==="
ls -la $GITHUB_WORKSPACE/bin/packages/${{ matrix.arch_info.arch }}/packages_ci/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch_info.arch }}-ipk-${{ matrix.ddnsto_type }}
path: bin/packages/${{ matrix.arch_info.arch }}/packages_ci/*.ipk
- name: Create release files
run: |
mkdir -p release/ipk
tar -zcvf release/ipk/${{ matrix.arch_info.arch }}-${{ matrix.ddnsto_type }}.tar.gz -C bin/packages/${{ matrix.arch_info.arch }}/ packages_ci
- name: Upload to release
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
name: DDNSTO ${{ env.build_time }}
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
allowUpdates: true
replacesArtifacts: false
artifacts: "release/ipk/${{ matrix.arch_info.arch }}-${{ matrix.ddnsto_type }}.tar.gz"
build-apk:
name: Build APK ${{ matrix.arch_info.arch }} (${{ matrix.ddnsto_type }})
runs-on: ubuntu-latest
needs: setup
if: github.event.inputs.build_type == 'apk_only' || github.event.inputs.build_type == 'all' || github.event_name == 'push'
strategy:
fail-fast: false
matrix:
arch_info: ${{ fromJson(needs.setup.outputs.matrix) }}
ddnsto_type: ${{ fromJson(needs.setup.outputs.ddnsto_types) }}
env:
DDNSTO_TYPE: ${{ matrix.ddnsto_type }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup variables
run: |
sudo timedatectl set-timezone 'Asia/Shanghai'
echo build_time="$(date '+%Y-%m-%d')" >> "$GITHUB_ENV"
- name: Cache SDK
id: cache-sdk
uses: actions/cache@v4
with:
path: ~/sdk
key: openwrt-sdk-25.12.2-${{ matrix.arch_info.arch }}-${{ matrix.ddnsto_type }}-${{ hashFiles('ddnsto/Makefile') }}-v3
restore-keys: |
openwrt-sdk-25.12.2-${{ matrix.arch_info.arch }}-${{ matrix.ddnsto_type }}-v3
- name: Download SDK
if: steps.cache-sdk.outputs.cache-hit != 'true'
run: |
mkdir -p ~/sdk
# APK 构建使用 OpenWrt 25.12.2 SDK(支持 APK 包格式)
case "${{ matrix.arch_info.arch }}" in
aarch64_generic)
SDK_URL="https://downloads.openwrt.org/releases/25.12.2/targets/armsr/armv8/openwrt-sdk-25.12.2-armsr-armv8_gcc-14.3.0_musl.Linux-x86_64.tar.zst"
;;
arm_cortex-a9)
SDK_URL="https://downloads.openwrt.org/releases/25.12.2/targets/mvebu/cortexa9/openwrt-sdk-25.12.2-mvebu-cortexa9_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst"
;;
x86_64)
SDK_URL="https://downloads.openwrt.org/releases/25.12.2/targets/x86/64/openwrt-sdk-25.12.2-x86-64_gcc-14.3.0_musl.Linux-x86_64.tar.zst"
;;
mipsel_24kc)
SDK_URL="https://downloads.openwrt.org/releases/25.12.2/targets/ramips/mt7621/openwrt-sdk-25.12.2-ramips-mt7621_gcc-14.3.0_musl.Linux-x86_64.tar.zst"
;;
esac
echo "Downloading SDK from $SDK_URL"
wget -q --show-progress -O ~/sdk/sdk.tar.zst "$SDK_URL"
echo "Extracting SDK..."
cd ~/sdk && tar -xf sdk.tar.zst --strip-components=1 && rm sdk.tar.zst
- name: Setup SDK
run: |
cd ~/sdk
# 安装主机编译依赖
sudo apt-get update
sudo apt-get install -y libncurses5-dev libncursesw5-dev
./scripts/feeds update -a || true
# 删除 u-boot-mediatek 包,避免 python3-setuptools 检测失败
rm -rf feeds/base/package/boot/uboot-mediatek
./scripts/feeds install -a || true
- name: Build Package
run: |
cd ~/sdk
# 清理旧的 ddnsto 构建目录和下载文件,确保完全重新编译
# 必须删除整个构建目录和下载文件,因为哈希值可能不匹配
# 注意:lite和standard使用不同的构建目录
echo "=== Cleaning old build directories and downloads ==="
rm -rf build_dir/target-*/ddnsto-binary*
rm -rf build_dir/target-*/.ddnsto-binary*
rm -f dl/ddnsto-binary*.tar.gz
rm -f dl/ddnsto-binary*.tar.gz.flock
rm -rf staging_dir/packages/*/ddnsto*
find bin/packages/ -name "ddnsto*.apk" -delete 2>/dev/null || true
# 直接复制包到package目录(不使用feeds机制)
rm -rf package/ddnsto
mkdir -p package/ddnsto
cp -r $GITHUB_WORKSPACE/ddnsto/* package/ddnsto/
echo "=== Package directory contents ==="
ls -la package/ddnsto/
# 配置
echo "CONFIG_PACKAGE_ddnsto=m" >> .config
make defconfig
# 构建前检查
echo "=== Pre-build check ==="
echo "DDNSTO_TYPE=$DDNSTO_TYPE"
ls -la build_dir/target-*/ddnsto-binary* 2>/dev/null || echo "No existing ddnsto build dir"
# 构建 - 使用详细输出
echo "=== Starting build with DDNSTO_TYPE=$DDNSTO_TYPE ==="
make package/ddnsto/compile V=sc -j1 2>&1 | tee build.log || {
echo "=== DDNSTO BUILD FAILED ==="
tail -100 build.log
exit 1
}
# 验证下载的二进制文件
echo "=== Verifying downloaded binary ==="
ls -la dl/ddnsto-binary*.tar.gz 2>/dev/null || echo "No tar.gz in dl"
if [ -f dl/ddnsto-binary-3.1.7.tar.gz ]; then
echo "Contents of standard tar.gz:"
tar -tzf dl/ddnsto-binary-3.1.7.tar.gz
echo "SHA256 of downloaded tar.gz:"
sha256sum dl/ddnsto-binary-3.1.7.tar.gz
echo "SHA256 of binaries inside standard tar.gz:"
tar -Oxf dl/ddnsto-binary-3.1.7.tar.gz ddnsto-binary-3.1.7/ddnsto.x86_64 2>/dev/null | sha256sum || echo "Cannot extract x86_64"
tar -Oxf dl/ddnsto-binary-3.1.7.tar.gz ddnsto-binary-3.1.7/ddnsto.aarch64 2>/dev/null | sha256sum || echo "Cannot extract aarch64"
fi
if [ -f dl/ddnsto-binary-lite-3.1.7.tar.gz ]; then
echo "Contents of lite tar.gz:"
tar -tzf dl/ddnsto-binary-lite-3.1.7.tar.gz
echo "SHA256 of downloaded lite tar.gz:"
sha256sum dl/ddnsto-binary-lite-3.1.7.tar.gz
echo "SHA256 of binaries inside lite tar.gz:"
tar -Oxf dl/ddnsto-binary-lite-3.1.7.tar.gz ddnsto-binary-lite-3.1.7/ddnsto.x86_64 2>/dev/null | sha256sum || echo "Cannot extract x86_64"
tar -Oxf dl/ddnsto-binary-lite-3.1.7.tar.gz ddnsto-binary-lite-3.1.7/ddnsto.aarch64 2>/dev/null | sha256sum || echo "Cannot extract aarch64"
fi
echo "Directory structure of build_dir:"
find build_dir/target-*/ddnsto-binary*/ -type d 2>/dev/null | head -20
echo "Files in build_dir:"
find build_dir/target-*/ddnsto-binary*/ -type f -ls 2>/dev/null || echo "No files found"
echo "SHA256 of ddnstod in .pkgdir:"
find build_dir/target-*/ddnsto-binary*/ -name "ddnstod" -type f -exec sha256sum {} \; 2>/dev/null || echo "No ddnstod found"
echo "SHA256 of ddnsto.* binaries in build_dir:"
find build_dir/target-*/ddnsto-binary*/ -name "ddnsto.*" -type f -exec sha256sum {} \; 2>/dev/null || echo "No ddnsto.* found"
echo "=== Post-build check ==="
ls -la build_dir/target-*/ddnsto-binary*/ 2>/dev/null || echo "Build dir not found"
find bin/packages/ -name "ddnsto*.apk" 2>/dev/null || echo "No APK found"
# 检查 APK 文件中的二进制哈希
echo "=== Checking APK content ==="
for apk in $(find bin/packages/ -name "ddnsto*.apk" 2>/dev/null); do
echo "APK file: $apk"
# 使用 tar 列出内容
tar -tzf "$apk" 2>/dev/null | grep -E "(ddnsto|sbin)" || echo "No ddnsto in tar listing"
done
# 复制输出
mkdir -p $GITHUB_WORKSPACE/bin/packages/${{ matrix.arch_info.arch }}/packages_ci
find bin/packages/ -name "ddnsto*.apk" -exec cp {} $GITHUB_WORKSPACE/bin/packages/${{ matrix.arch_info.arch }}/packages_ci/ \;
echo "=== Final packages ==="
ls -la $GITHUB_WORKSPACE/bin/packages/${{ matrix.arch_info.arch }}/packages_ci/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch_info.arch }}-apk-${{ matrix.ddnsto_type }}
path: bin/packages/${{ matrix.arch_info.arch }}/packages_ci/*.apk
- name: Create release files
run: |
mkdir -p release/apk
tar -zcvf release/apk/${{ matrix.arch_info.arch }}-${{ matrix.ddnsto_type }}.tar.gz -C bin/packages/${{ matrix.arch_info.arch }}/ packages_ci
- name: Upload to release
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
name: DDNSTO ${{ env.build_time }}
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
allowUpdates: true
replacesArtifacts: false
artifacts: "release/apk/${{ matrix.arch_info.arch }}-${{ matrix.ddnsto_type }}.tar.gz"