Skip to content

Commit 7ea84dc

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

1 file changed

Lines changed: 46 additions & 48 deletions

File tree

.github/workflows/build-ipk.yml

Lines changed: 46 additions & 48 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,9 @@ jobs:
6966
- arm_cortex-a9
7067
- mipsel_24kc
7168
- x86_64
69+
include:
70+
- { branch: openwrt-24.10, package_type: ipk }
71+
- { branch: 25.12.0-rc5, package_type: apk }
7272
container:
7373
image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.branch }}
7474
options: --user root
@@ -120,8 +120,7 @@ jobs:
120120
121121
- name: Install dependencies
122122
working-directory: /builder
123-
run: |
124-
apt update && apt install -y upx-ucl
123+
run: apt update && apt install -y upx-ucl
125124

126125
- name: Prepare package structure
127126
working-directory: /builder
@@ -133,7 +132,7 @@ jobs:
133132
echo "=== Package structure ==="
134133
ls -laR package/beszel-agent/files/
135134
136-
- name: Build IPK
135+
- name: Build package
137136
working-directory: /builder
138137
env:
139138
VERSION: ${{ steps.prepare.outputs.version }}
@@ -150,54 +149,54 @@ jobs:
150149
env:
151150
ARCH: ${{ matrix.arch }}
152151
BRANCH: ${{ matrix.branch }}
152+
PKG_TYPE: ${{ matrix.package_type }}
153153
run: |
154154
set -euo pipefail
155-
echo "=== Searching for IPK files ==="
156-
find /builder/bin/packages -name "beszel-agent*.ipk" -ls || true
155+
echo "=== Searching for package files ==="
156+
find /builder/bin/packages -name "beszel-agent*.$PKG_TYPE" -ls || true
157157
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+
mkdir -p $GITHUB_WORKSPACE/pkg-output
159+
find /builder/bin/packages -name "beszel-agent*.$PKG_TYPE" \
160+
-exec cp {} $GITHUB_WORKSPACE/pkg-output/ \;
161+
cd $GITHUB_WORKSPACE/pkg-output
161162
162-
echo "=== Files in ipk-output ==="
163+
echo "=== Files in pkg-output ==="
163164
ls -la
164165
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
166+
PKG_COUNT=$(ls beszel-agent*.$PKG_TYPE 2>/dev/null | wc -l)
167+
if [[ $PKG_COUNT -eq 0 ]]; then
168+
echo "ERROR: No $PKG_TYPE file found!" >&2
169169
exit 1
170170
fi
171-
172-
echo "Found $IPK_COUNT IPK file(s)"
171+
echo "Found $PKG_COUNT $PKG_TYPE file(s)"
173172
174173
VERSION_DIR="${BRANCH/openwrt-}/$ARCH"
175174
mkdir -p "$VERSION_DIR"
176-
mv *.ipk "$VERSION_DIR/"
175+
mv *.$PKG_TYPE "$VERSION_DIR/"
177176
cd "$VERSION_DIR"
177+
sha256sum *.$PKG_TYPE > SHA256SUMS
178178
179-
sha256sum *.ipk > SHA256SUMS
180-
181-
cd $GITHUB_WORKSPACE/ipk-output
182-
tar -cvf $GITHUB_WORKSPACE/ipk-$BRANCH-$ARCH.tar "$VERSION_DIR"
179+
cd $GITHUB_WORKSPACE/pkg-output
180+
tar -cvf $GITHUB_WORKSPACE/pkg-$BRANCH-$ARCH.tar "$VERSION_DIR"
183181
184-
- name: Validate IPK package
182+
- name: Validate package
185183
env:
186184
ARCH: ${{ matrix.arch }}
187185
BRANCH: ${{ matrix.branch }}
186+
PKG_TYPE: ${{ matrix.package_type }}
188187
run: |
189188
set -euo pipefail
190189
VERSION_DIR="${BRANCH/openwrt-}/$ARCH"
191-
cd ipk-output/$VERSION_DIR
190+
cd pkg-output/$VERSION_DIR
192191
193192
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")
193+
for pkg in *.$PKG_TYPE; do
194+
size=$(stat -c%s "$pkg")
196195
if [[ $size -lt 10000 ]]; then
197-
echo "ERROR: IPK file $ipk is too small ($size bytes)" >&2
196+
echo "ERROR: $pkg is too small ($size bytes)" >&2
198197
exit 1
199198
fi
200-
echo "✓ $ipk size: $size bytes"
199+
echo "✓ $pkg size: $size bytes"
201200
done
202201
203202
sha256sum -c SHA256SUMS
@@ -207,10 +206,10 @@ jobs:
207206
if: success()
208207
uses: actions/upload-artifact@v4
209208
with:
210-
name: ipk-${{ matrix.branch }}-${{ matrix.arch }}
209+
name: pkg-${{ matrix.branch }}-${{ matrix.arch }}
211210
path: |
212-
ipk-output/**/*.ipk
213-
ipk-output/**/SHA256SUMS
211+
pkg-output/**/*.${{ matrix.package_type }}
212+
pkg-output/**/SHA256SUMS
214213
if-no-files-found: error
215214
retention-days: 30
216215

@@ -224,12 +223,12 @@ jobs:
224223
- name: Download artifacts
225224
uses: actions/download-artifact@v4
226225
with:
227-
pattern: ipk-*
226+
pattern: pkg-*
228227

229228
- name: Prepare files
230229
run: |
231230
mkdir public
232-
find . -name 'ipk-*.tar' -exec tar -C ./public -xvf {} \;
231+
find . -name 'pkg-*.tar' -exec tar -C ./public -xvf {} \;
233232
234233
- name: Deploy to GH pages
235234
uses: peaceiris/actions-gh-pages@v4
@@ -246,30 +245,29 @@ jobs:
246245
permissions:
247246
contents: write
248247
runs-on: ubuntu-latest
249-
strategy:
250-
max-parallel: 1
251-
matrix:
252-
branch:
253-
- '24.10'
254248
steps:
255249
- name: Download artifacts
256250
uses: actions/download-artifact@v4
257251
with:
258-
pattern: ipk-*
252+
pattern: pkg-*
259253

260254
- name: Prepare files
261-
env:
262-
BRANCH: ${{ matrix.branch }}
263255
run: |
264-
find . -name "ipk-openwrt-$BRANCH-*.tar" -exec tar -xvf {} --wildcards '*.ipk' \;
256+
find . -name "pkg-openwrt-*.tar" \
257+
-exec tar -xvf {} --wildcards "*.ipk" --wildcards "*.apk" \;
265258
266259
- name: Upload release assets
267260
uses: softprops/action-gh-release@v2
268261
with:
269262
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 }}
263+
tag_name: ${{ needs.validate-versions.outputs.latest_upstream_version }}
264+
name: ${{ needs.validate-versions.outputs.latest_upstream_version }}
272265
target_commitish: gh-pages
273266
body: |
274-
### Beszel Agent ${{ needs.validate-versions.outputs.latest_upstream_version }} for OpenWrt ${{ matrix.branch }}
275-
files: ./**/*.ipk
267+
### Beszel Agent ${{ needs.validate-versions.outputs.latest_upstream_version }}
268+
269+
**IPK** — OpenWrt 24.10
270+
**APK** — OpenWrt 25.12
271+
files: |
272+
./**/*.ipk
273+
./**/*.apk

0 commit comments

Comments
 (0)