Skip to content

Commit 6adaa35

Browse files
committed
ci: add apk (closes #3)
1 parent 7719426 commit 6adaa35

1 file changed

Lines changed: 55 additions & 49 deletions

File tree

.github/workflows/build-ipk.yml

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Beszel Agent IPK
1+
name: Build Beszel Agent IPK/APK
22

33
on:
44
workflow_dispatch:
@@ -38,7 +38,6 @@ jobs:
3838
echo "Latest repo release: $LATEST_REPO"
3939
4040
REPO_VERSION=${LATEST_REPO%%-*}
41-
4241
echo "Repo base version: $REPO_VERSION"
4342
4443
if [ "$LATEST_UPSTREAM" != "$REPO_VERSION" ]; then
@@ -59,8 +58,6 @@ jobs:
5958
strategy:
6059
fail-fast: false
6160
matrix:
62-
branch:
63-
- openwrt-24.10
6461
arch:
6562
- aarch64_cortex-a53
6663
- aarch64_cortex-a72
@@ -69,6 +66,12 @@ jobs:
6966
- arm_cortex-a9
7067
- mipsel_24kc
7168
- x86_64
69+
branch:
70+
- openwrt-24.10
71+
- 25.12.0-rc5
72+
include:
73+
- { branch: openwrt-24.10, package_type: ipk }
74+
- { branch: 25.12.0-rc5, package_type: apk }
7275
container:
7376
image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.branch }}
7477
options: --user root
@@ -120,8 +123,7 @@ jobs:
120123
121124
- name: Install dependencies
122125
working-directory: /builder
123-
run: |
124-
apt update && apt install -y upx-ucl
126+
run: apt update && apt install -y upx-ucl
125127

126128
- name: Prepare package structure
127129
working-directory: /builder
@@ -133,7 +135,7 @@ jobs:
133135
echo "=== Package structure ==="
134136
ls -laR package/beszel-agent/files/
135137
136-
- name: Build IPK
138+
- name: Build package
137139
working-directory: /builder
138140
env:
139141
VERSION: ${{ steps.prepare.outputs.version }}
@@ -150,54 +152,59 @@ jobs:
150152
env:
151153
ARCH: ${{ matrix.arch }}
152154
BRANCH: ${{ matrix.branch }}
155+
PKG_TYPE: ${{ matrix.package_type }}
153156
run: |
154157
set -euo pipefail
155-
echo "=== Searching for IPK files ==="
156-
find /builder/bin/packages -name "beszel-agent*.ipk" -ls || true
157-
158-
mkdir -p $GITHUB_WORKSPACE/ipk-output
159-
find /builder/bin/packages -name "beszel-agent*.ipk" -exec cp {} $GITHUB_WORKSPACE/ipk-output/ \;
160-
cd $GITHUB_WORKSPACE/ipk-output
158+
echo "=== Searching for package files ==="
159+
find /builder/bin/packages -name "beszel-agent*.$PKG_TYPE" -ls || true
160+
161+
mkdir -p $GITHUB_WORKSPACE/pkg-output
162+
find /builder/bin/packages -name "beszel-agent*.$PKG_TYPE" | while read f; do
163+
filename=$(basename "$f")
164+
if [[ "$PKG_TYPE" == "apk" ]]; then
165+
filename="${filename%.apk}_${ARCH}.apk"
166+
fi
167+
cp "$f" "$GITHUB_WORKSPACE/pkg-output/$filename"
168+
done
161169
162-
echo "=== Files in ipk-output ==="
170+
cd $GITHUB_WORKSPACE/pkg-output
171+
echo "=== Files in pkg-output ==="
163172
ls -la
164173
165-
IPK_COUNT=$(ls beszel-agent*.ipk 2>/dev/null | wc -l)
166-
167-
if [[ $IPK_COUNT -eq 0 ]]; then
168-
echo "ERROR: No IPK file found!" >&2
174+
PKG_COUNT=$(ls beszel-agent*.$PKG_TYPE 2>/dev/null | wc -l)
175+
if [[ $PKG_COUNT -eq 0 ]]; then
176+
echo "ERROR: No $PKG_TYPE file found!" >&2
169177
exit 1
170178
fi
171-
172-
echo "Found $IPK_COUNT IPK file(s)"
179+
echo "Found $PKG_COUNT $PKG_TYPE file(s)"
173180
174181
VERSION_DIR="${BRANCH/openwrt-}/$ARCH"
175182
mkdir -p "$VERSION_DIR"
176-
mv *.ipk "$VERSION_DIR/"
183+
mv *.$PKG_TYPE "$VERSION_DIR/"
177184
cd "$VERSION_DIR"
185+
sha256sum *.$PKG_TYPE > SHA256SUMS
178186
179-
sha256sum *.ipk > SHA256SUMS
180-
181-
cd $GITHUB_WORKSPACE/ipk-output
182-
tar -cvf $GITHUB_WORKSPACE/ipk-$BRANCH-$ARCH.tar "$VERSION_DIR"
187+
cd $GITHUB_WORKSPACE/pkg-output
188+
tar -cvf $GITHUB_WORKSPACE/pkg-$BRANCH-$ARCH.tar "$VERSION_DIR"
183189
184-
- name: Validate IPK package
190+
- name: Validate package
185191
env:
186192
ARCH: ${{ matrix.arch }}
187193
BRANCH: ${{ matrix.branch }}
194+
PKG_TYPE: ${{ matrix.package_type }}
188195
run: |
189196
set -euo pipefail
190197
VERSION_DIR="${BRANCH/openwrt-}/$ARCH"
191-
cd ipk-output/$VERSION_DIR
198+
cd pkg-output/$VERSION_DIR
192199
193200
echo "=== Validating packages in $VERSION_DIR ==="
194-
for ipk in *.ipk; do
195-
size=$(stat -f%z "$ipk" 2>/dev/null || stat -c%s "$ipk")
201+
for pkg in *.$PKG_TYPE; do
202+
size=$(stat -c%s "$pkg")
196203
if [[ $size -lt 10000 ]]; then
197-
echo "ERROR: IPK file $ipk is too small ($size bytes)" >&2
204+
echo "ERROR: $pkg is too small ($size bytes)" >&2
198205
exit 1
199206
fi
200-
echo "✓ $ipk size: $size bytes"
207+
echo "✓ $pkg size: $size bytes"
201208
done
202209
203210
sha256sum -c SHA256SUMS
@@ -207,10 +214,10 @@ jobs:
207214
if: success()
208215
uses: actions/upload-artifact@v4
209216
with:
210-
name: ipk-${{ matrix.branch }}-${{ matrix.arch }}
217+
name: pkg-${{ matrix.branch }}-${{ matrix.arch }}
211218
path: |
212-
ipk-output/**/*.ipk
213-
ipk-output/**/SHA256SUMS
219+
pkg-output/**/*.${{ matrix.package_type }}
220+
pkg-output/**/SHA256SUMS
214221
if-no-files-found: error
215222
retention-days: 30
216223

@@ -224,12 +231,12 @@ jobs:
224231
- name: Download artifacts
225232
uses: actions/download-artifact@v4
226233
with:
227-
pattern: ipk-*
234+
pattern: pkg-*
228235

229236
- name: Prepare files
230237
run: |
231238
mkdir public
232-
find . -name 'ipk-*.tar' -exec tar -C ./public -xvf {} \;
239+
find . -name 'pkg-*.tar' -exec tar -C ./public -xvf {} \;
233240
234241
- name: Deploy to GH pages
235242
uses: peaceiris/actions-gh-pages@v4
@@ -246,30 +253,29 @@ jobs:
246253
permissions:
247254
contents: write
248255
runs-on: ubuntu-latest
249-
strategy:
250-
max-parallel: 1
251-
matrix:
252-
branch:
253-
- '24.10'
254256
steps:
255257
- name: Download artifacts
256258
uses: actions/download-artifact@v4
257259
with:
258-
pattern: ipk-*
260+
pattern: pkg-*
259261

260262
- name: Prepare files
261-
env:
262-
BRANCH: ${{ matrix.branch }}
263263
run: |
264-
find . -name "ipk-openwrt-$BRANCH-*.tar" -exec tar -xvf {} --wildcards '*.ipk' \;
264+
find . -name "pkg-openwrt-*.tar" \
265+
-exec tar -xvf {} --wildcards "*.ipk" --wildcards "*.apk" \;
265266
266267
- name: Upload release assets
267268
uses: softprops/action-gh-release@v2
268269
with:
269270
fail_on_unmatched_files: true
270-
tag_name: ${{ needs.validate-versions.outputs.latest_upstream_version }}-${{ matrix.branch }}
271-
name: ${{ needs.validate-versions.outputs.latest_upstream_version }} for OpenWrt ${{ matrix.branch }}
271+
tag_name: ${{ needs.validate-versions.outputs.latest_upstream_version }}
272+
name: ${{ needs.validate-versions.outputs.latest_upstream_version }}
272273
target_commitish: gh-pages
273274
body: |
274-
### Beszel Agent ${{ needs.validate-versions.outputs.latest_upstream_version }} for OpenWrt ${{ matrix.branch }}
275-
files: ./**/*.ipk
275+
### Beszel Agent ${{ needs.validate-versions.outputs.latest_upstream_version }}
276+
277+
**IPK** — OpenWrt 24.10
278+
**APK** — OpenWrt 25.12
279+
files: |
280+
./**/*.ipk
281+
./**/*.apk

0 commit comments

Comments
 (0)