-
Notifications
You must be signed in to change notification settings - Fork 4
341 lines (322 loc) ยท 12.8 KB
/
Copy pathopenwrt-release.yml
File metadata and controls
341 lines (322 loc) ยท 12.8 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
permissions:
contents: write
name: Build OpenWrt Package
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
test:
name: Functional tests
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Run functional tests
run: bash tests/run_tests.sh
build:
name: Build for ${{ matrix.version }} / ${{ matrix.target }}
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
env:
REPO_APK_KEY: ${{ secrets.REPO_APK_KEY }}
PKG_NAME: ${{ github.event.repository.name }}
strategy:
fail-fast: false
matrix:
include:
# 24.10 (ipk, all OpenWrt-supported arches)
- version: openwrt-24.10
target: aarch64_cortex-a53
- version: openwrt-24.10
target: aarch64_cortex-a72
- version: openwrt-24.10
target: aarch64_cortex-a76
- version: openwrt-24.10
target: aarch64_generic
- version: openwrt-24.10
target: arm_arm1176jzf-s_vfp
- version: openwrt-24.10
target: arm_arm926ej-s
- version: openwrt-24.10
target: arm_cortex-a15_neon-vfpv4
- version: openwrt-24.10
target: arm_cortex-a5_vfpv4
- version: openwrt-24.10
target: arm_cortex-a7
- version: openwrt-24.10
target: arm_cortex-a7_neon-vfpv4
- version: openwrt-24.10
target: arm_cortex-a7_vfpv4
- version: openwrt-24.10
target: arm_cortex-a8_vfpv3
- version: openwrt-24.10
target: arm_cortex-a9
- version: openwrt-24.10
target: arm_cortex-a9_neon
- version: openwrt-24.10
target: arm_cortex-a9_vfpv3-d16
- version: openwrt-24.10
target: arm_fa526
- version: openwrt-24.10
target: arm_xscale
- version: openwrt-24.10
target: armeb_xscale
- version: openwrt-24.10
target: i386_pentium-mmx
- version: openwrt-24.10
target: i386_pentium4
- version: openwrt-24.10
target: loongarch64_generic
- version: openwrt-24.10
target: mips64_mips64r2
- version: openwrt-24.10
target: mips64_octeonplus
- version: openwrt-24.10
target: mips64el_mips64r2
- version: openwrt-24.10
target: mips_24kc
- version: openwrt-24.10
target: mips_4kec
- version: openwrt-24.10
target: mips_mips32
- version: openwrt-24.10
target: mipsel_24kc
- version: openwrt-24.10
target: mipsel_24kc_24kf
- version: openwrt-24.10
target: mipsel_74kc
- version: openwrt-24.10
target: mipsel_mips32
- version: openwrt-24.10
target: powerpc64_e5500
- version: openwrt-24.10
target: powerpc_464fp
- version: openwrt-24.10
target: powerpc_8548
- version: openwrt-24.10
target: riscv64_riscv64
- version: openwrt-24.10
target: x86_64
# 25.12 (apk, all OpenWrt-supported arches)
- version: openwrt-25.12
target: aarch64_cortex-a53
- version: openwrt-25.12
target: aarch64_cortex-a72
- version: openwrt-25.12
target: aarch64_cortex-a76
- version: openwrt-25.12
target: aarch64_generic
- version: openwrt-25.12
target: arm_arm1176jzf-s_vfp
- version: openwrt-25.12
target: arm_arm926ej-s
- version: openwrt-25.12
target: arm_cortex-a15_neon-vfpv4
- version: openwrt-25.12
target: arm_cortex-a5_vfpv4
- version: openwrt-25.12
target: arm_cortex-a7
- version: openwrt-25.12
target: arm_cortex-a7_neon-vfpv4
- version: openwrt-25.12
target: arm_cortex-a7_vfpv4
- version: openwrt-25.12
target: arm_cortex-a8_vfpv3
- version: openwrt-25.12
target: arm_cortex-a9
- version: openwrt-25.12
target: arm_cortex-a9_neon
- version: openwrt-25.12
target: arm_cortex-a9_vfpv3-d16
- version: openwrt-25.12
target: arm_fa526
- version: openwrt-25.12
target: arm_xscale
- version: openwrt-25.12
target: armeb_xscale
- version: openwrt-25.12
target: i386_pentium-mmx
- version: openwrt-25.12
target: i386_pentium4
- version: openwrt-25.12
target: loongarch64_generic
- version: openwrt-25.12
target: mips64_mips64r2
- version: openwrt-25.12
target: mips64_octeonplus
- version: openwrt-25.12
target: mips64el_mips64r2
- version: openwrt-25.12
target: mips_24kc
- version: openwrt-25.12
target: mips_mips32
- version: openwrt-25.12
target: mipsel_24kc
- version: openwrt-25.12
target: mipsel_24kc_24kf
- version: openwrt-25.12
target: mipsel_74kc
- version: openwrt-25.12
target: mipsel_mips32
- version: openwrt-25.12
target: powerpc64_e5500
- version: openwrt-25.12
target: powerpc_464fp
- version: openwrt-25.12
target: powerpc_8548
- version: openwrt-25.12
target: riscv64_generic
- version: openwrt-25.12
target: x86_64
steps:
- name: ๐งพ Checkout repo
uses: actions/checkout@v5
- name: ๐งฐ Set up melmac feed structure
run: |
# Create a proper OpenWrt feed layout where each package lives in its own subdir
mkdir -p feed/${PKG_NAME}
# Copy the package sources into the feed subdir (exclude CI and feed itself)
rsync -av \
--exclude='.git' \
--exclude='feed' \
--exclude='.github' \
./ feed/${PKG_NAME}/
- name: โ
Validate shell script syntax
run: |
echo "๐ Checking shell script syntax..."
find feed/${PKG_NAME}/files/etc/init.d/ -type f -name '*' 2>/dev/null | while read -r script; do
if [ -f "$script" ]; then
echo "Checking syntax of: $script"
bash -n "$script" || { echo "โ Syntax error in $script"; exit 1; }
echo "โ
$script syntax OK"
fi
done
echo "โ
All shell scripts passed syntax validation"
- name: ๐งฎ Compute ARCH
run: |
# matrix.version is the release-line LABEL baked into artifact filenames
# (sync_repo.sh matches *_openwrt-25.12_*), NOT the SDK image tag. Pin the
# SDK to a specific STABLE point release so builds are reproducible and
# immune to <ver>-SNAPSHOT mirror churn (rotated/truncated tarballs โ
# sha256 mismatch). Bump these when a new point release ships.
case "${{ matrix.version }}" in
openwrt-25.12) SDK_VERSION="25.12.5" ;;
openwrt-24.10) SDK_VERSION="24.10.7" ;;
snapshots) SDK_VERSION="SNAPSHOT" ;;
*) SDK_VERSION="${{ matrix.version }}" ;;
esac
echo "ARCH=${{ matrix.target }}-${SDK_VERSION}" >> "$GITHUB_ENV"
- name: ๐๏ธ Build with OpenWrt SDK
uses: openwrt/gh-action-sdk@v8
env:
ARCH: ${{ env.ARCH }}
FEEDNAME: melmac
PACKAGES: ${{ env.PKG_NAME }}
INDEX: 0
FEED_DIR: ${{ github.workspace }}/feed
NO_SHFMT_CHECK: 1
NO_REFRESH_CHECK: 1
PRIVATE_KEY: ${{ secrets.REPO_APK_KEY }}
# - name: ๐ Debug build output
# run: |
# echo "=== Build directory structure ==="
# find . -name "*.ipk" -type f 2>/dev/null || echo "No .ipk files found"
# echo "=== bin directory structure ==="
# ls -la bin/ 2>/dev/null || echo "No bin directory found"
# if [ -d "bin/packages" ]; then
# echo "=== packages directory structure ==="
# find bin/packages/ -type f -name "*.ipk" 2>/dev/null || echo "No .ipk files in packages directory"
# echo "=== Full packages directory tree ==="
# ls -laR bin/packages/ 2>/dev/null || echo "No packages directory"
# fi
- name: ๐ท๏ธ Rename APK with version and target
run: |
set -euo pipefail
PKG_VERSION=$(grep -E '^PKG_VERSION *:?=' Makefile | head -n1 | cut -d= -f2 | tr -d '[:space:]')
PKG_RELEASE=$(grep -E '^PKG_RELEASE *:?=' Makefile | head -n1 | cut -d= -f2 | tr -d '[:space:]')
for ext in ipk apk; do
# apk keeps OpenWrt's 'r' release prefix (โฆ-r5.apk); opkg does not
case "$ext" in apk) REL="r${PKG_RELEASE}" ;; *) REL="${PKG_RELEASE}" ;; esac
for f in $(find bin/packages -type f -path "*/melmac/*.${ext}"); do
dir=$(dirname "$f")
mv -v "$f" "$dir/${PKG_NAME}-${PKG_VERSION}-${REL}_${{ matrix.version }}_${{ matrix.target }}.${ext}"
done
done
- name: ๐ฆ Upload artifact for ${{ matrix.target }}
uses: actions/upload-artifact@v7
with:
name: ${{ env.PKG_NAME }}-${{ matrix.target }}-${{ matrix.version }}
path: |
bin/packages/*/melmac/${{ env.PKG_NAME }}*.ipk
bin/packages/*/melmac/${{ env.PKG_NAME }}*.apk
# bin/packages/*/melmac/Packages*
# bin/packages/*/melmac/index.json
# bin/packages/*/melmac/packages.adb
if-no-files-found: ignore
release:
name: Release ${{ github.repository }}
needs: build
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: ๐งพ Checkout repo
uses: actions/checkout@v5
- name: ๐ Extract version and release from Makefile
id: version
run: |
PKG_VERSION=$(grep -E '^PKG_VERSION *:?=' Makefile | head -n1 | cut -d= -f2 | tr -d '[:space:]')
PKG_RELEASE=$(grep -E '^PKG_RELEASE *:?=' Makefile | head -n1 | cut -d= -f2 | tr -d '[:space:]')
COMBINED_VERSION="${PKG_VERSION}-${PKG_RELEASE}"
echo "๐ฆ Version: $COMBINED_VERSION"
echo "version=$COMBINED_VERSION" >> "$GITHUB_OUTPUT"
- name: โฌ๏ธ Download all build artifacts
uses: actions/download-artifact@v8
with:
path: ./release-assets
- name: ๐๏ธ Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
name: Build v${{ steps.version.outputs.version }}
files: |
./release-assets/**/*.ipk
./release-assets/**/*.apk
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: ๐งน Prune stale release assets
# Delete assets on the tag that THIS build did not produce, so an arch or
# release line you stopped building no longer lingers on the release (and
# no longer gets re-published by sync_repo.sh, which pulls from releases).
# Gated on a fully green build + a non-empty keep set so a transient arch
# failure or an empty build can never wipe a still-good binary.
if: needs.build.result == 'success'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: v${{ steps.version.outputs.version }}
run: |
keep=$(find release-assets -type f \( -name '*.ipk' -o -name '*.apk' \) \
-exec basename {} \; | sort -u)
[ -n "$keep" ] || { echo "no packages built โ skipping prune"; exit 0; }
gh release view "$TAG" --json assets --jq '.assets[].name' | while read -r a; do
case "$a" in *.ipk|*.apk) ;; *) continue ;; esac
printf '%s\n' "$keep" | grep -qxF -- "$a" || {
echo "pruning stale asset: $a"
gh release delete-asset "$TAG" "$a" --yes
}
done
- name: ๐ Notify repo.mossdef.org
# Event-driven sync: ping the repo so it publishes this release immediately
# instead of waiting for its hourly poll. Non-fatal if the token is absent.
if: needs.build.result == 'success'
env:
GH_TOKEN: ${{ secrets.SYNC_DISPATCH_TOKEN }}
run: |
gh api -X POST /repos/mossdef-org/repo.mossdef.org/dispatches \
-f event_type=package-released \
|| echo "dispatch failed โ repo.mossdef.org still syncs on its hourly schedule"