-
Notifications
You must be signed in to change notification settings - Fork 273
472 lines (403 loc) · 14.4 KB
/
release.yaml
File metadata and controls
472 lines (403 loc) · 14.4 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
name: Release
on:
release:
types:
- published
jobs:
versioned:
name: Generate versioned Makefiles
if: ${{ !github.event.release.prerelease }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
ref: ${{ github.event.release.tag_name }}
- name: Set version environment variable
run: |
RELEASE_TAG="${{ github.event.release.tag_name }}"
echo "RELEASE_VERSION=${RELEASE_TAG#v}" >> $GITHUB_ENV
- name: Generate versioned Makefiles
run: ./scripts/generate-versioned-makefiles.sh
- name: Commit and push versioned Makefiles
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add openwrt-support/rtp2httpd/Makefile.versioned openwrt-support/luci-app-rtp2httpd/Makefile.versioned
git commit -m "chore: update versioned Makefiles for ${{ github.event.release.tag_name }}"
git push origin HEAD:main
frontend:
name: Build frontend
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ github.event.release.tag_name }}
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
- name: Set up Corepack
run: corepack enable
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Build frontend
run: pnpm run web-ui:build
- name: Save generated pages
run: |
cp src/embedded_web_data.h /tmp/embedded_web_data.h
- name: Upload page artifacts
uses: actions/upload-artifact@v4
with:
name: frontend-pages
path: |
src/embedded_web_data.h
if-no-files-found: error
- name: Check frontend pages are up-to-date
run: |
set -euo pipefail
cp /tmp/embedded_web_data.h src/embedded_web_data.h
if ! git diff --quiet --exit-code src/embedded_web_data.h; then
echo "::error::Frontend pages are out of sync with the tag!"
echo "::error::The built frontend files differ from those in the repository."
echo "::error::Please commit the updated frontend pages and create a new tag."
exit 1
fi
echo "Frontend pages are up-to-date."
docker:
name: Docker
needs: frontend
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
ref: ${{ github.event.release.tag_name }}
- name: Set version environment variable
run: |
RELEASE_TAG="${{ github.event.release.tag_name }}"
echo "RELEASE_VERSION=${RELEASE_TAG#v}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
openwrt-packages:
name: OpenWRT ${{ matrix.sdk }}-${{ matrix.arch }}
needs: frontend
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
fail-fast: false
matrix:
arch:
- x86_64
- aarch64_cortex-a53
- aarch64_cortex-a72
- aarch64_cortex-a76
- aarch64_generic
- arm_cortex-a5_vfpv4
- arm_cortex-a7
- arm_cortex-a7_neon-vfpv4
- arm_cortex-a7_vfpv4
- arm_cortex-a9
- arm_cortex-a9_neon
- arm_cortex-a9_vfpv3-d16
- arm_cortex-a15_neon-vfpv4
- mips_24kc
- mips_mips32
- mipsel_24kc
- mipsel_24kc_24kf
- mipsel_74kc
- mipsel_mips32
sdk:
- "24.10.4" # For IPK
- "25.12.0" # For APK
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
ref: ${{ github.event.release.tag_name }}
- name: Build
uses: openwrt/gh-action-sdk@v9
env:
ARCH: ${{ matrix.arch }}-${{ matrix.sdk }}
NO_SHFMT_CHECK: true
PACKAGES: ${{ matrix.arch == 'x86_64' && 'luci-app-rtp2httpd' || 'rtp2httpd' }}
V: sc
- name: Upload to release assets
run: |
set -x
echo "Checking for built packages..."
ls -la bin/packages/${{ matrix.arch }}/action/ || echo "Directory not found"
# Upload IPK files if they exist (IPK already includes arch in filename)
if ls bin/packages/${{ matrix.arch }}/action/*.ipk 1> /dev/null 2>&1; then
echo "Uploading IPK files..."
gh release upload --repo ${{ github.repository }} ${{ github.event.release.tag_name }} bin/packages/${{ matrix.arch }}/action/*.ipk
else
echo "No IPK files found"
fi
# Upload APK files if they exist (rename to include arch suffix)
if ls bin/packages/${{ matrix.arch }}/action/*.apk 1> /dev/null 2>&1; then
echo "Processing APK files..."
for apk_file in bin/packages/${{ matrix.arch }}/action/*.apk; do
filename=$(basename "$apk_file")
# Skip luci packages (keep original name)
if [[ "$filename" == luci-* ]]; then
echo "Uploading luci package: $filename"
gh release upload --repo ${{ github.repository }} ${{ github.event.release.tag_name }} "$apk_file"
continue
fi
# Add architecture suffix for non-luci packages
# e.g., rtp2httpd-3.0.0_beta3-r1.apk -> rtp2httpd-3.0.0_beta3-r1_x86_64.apk
new_filename="${filename%.apk}_${{ matrix.arch }}.apk"
echo "Renaming: $filename -> $new_filename"
cp "$apk_file" "/tmp/$new_filename"
gh release upload --repo ${{ github.repository }} ${{ github.event.release.tag_name }} "/tmp/$new_filename"
done
else
echo "No APK files found"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
linux-static-bin:
name: Linux binary ${{ matrix.arch }}
needs: frontend
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
fail-fast: false
matrix:
arch:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- armv7-unknown-linux-musleabihf
- armv7-unknown-linux-musleabi
- arm-unknown-linux-musleabihf
- arm-unknown-linux-musleabi
- mipsel-unknown-linux-musl
- mips-unknown-linux-musl
- mips64-unknown-linux-musl
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
ref: ${{ github.event.release.tag_name }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
cmake \
build-essential \
wget \
xz-utils
- name: Set version environment variable
run: |
RELEASE_TAG="${{ github.event.release.tag_name }}"
echo "RELEASE_VERSION=${RELEASE_TAG#v}" >> $GITHUB_ENV
- name: Build static binary
env:
TOOLCHAIN_PREFIX: ${{ matrix.arch }}
run: ./scripts/build-static.sh
- name: Prepare release artifact
id: prepare
run: |
ARCH="${{ matrix.arch }}"
if [[ "$ARCH" == arm* ]]; then
BASE_ARCH="${ARCH%%-*}"
if [[ "$ARCH" == *"eabihf"* ]]; then
ARCH_SHORT="${BASE_ARCH}-eabihf"
elif [[ "$ARCH" == *"eabi"* ]]; then
ARCH_SHORT="${BASE_ARCH}-eabi"
else
ARCH_SHORT="$BASE_ARCH"
fi
else
ARCH_SHORT="${ARCH%%-*}"
fi
BINARY_PATH="build-${ARCH}-static/dist/usr/bin/rtp2httpd"
if [ ! -f "$BINARY_PATH" ]; then
echo "Error: Binary not found at $BINARY_PATH"
exit 1
fi
OUTPUT_NAME="rtp2httpd-${RELEASE_VERSION}-${ARCH_SHORT}"
cp "$BINARY_PATH" "$OUTPUT_NAME"
file "$OUTPUT_NAME"
ls -lh "$OUTPUT_NAME"
echo "binary_name=$OUTPUT_NAME" >> $GITHUB_OUTPUT
- name: Upload to release assets
run: |
gh release upload \
--repo ${{ github.repository }} \
${{ github.event.release.tag_name }} \
${{ steps.prepare.outputs.binary_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
macos-static-bin:
name: macOS binary ${{ matrix.arch }}
needs: frontend
runs-on: ${{ matrix.runner }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: macos-26-intel
- arch: arm64
runner: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
ref: ${{ github.event.release.tag_name }}
- name: Set version environment variable
run: |
RELEASE_TAG="${{ github.event.release.tag_name }}"
echo "RELEASE_VERSION=${RELEASE_TAG#v}" >> $GITHUB_ENV
- name: Build binary
run: |
BUILD_DIR="build-macos-${{ matrix.arch }}"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
RELEASE_VERSION="${RELEASE_VERSION}" cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_AGGRESSIVE_OPT=ON \
-DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build . -j$(getconf _NPROCESSORS_ONLN)
DESTDIR="$(pwd)/dist" cmake --install . --strip
- name: Prepare release artifact
id: prepare
run: |
BUILD_DIR="build-macos-${{ matrix.arch }}"
BINARY_PATH="${BUILD_DIR}/dist/usr/local/bin/rtp2httpd"
if [ ! -f "$BINARY_PATH" ]; then
echo "Error: Binary not found at $BINARY_PATH"
exit 1
fi
OUTPUT_NAME="rtp2httpd-${RELEASE_VERSION}-macos-${{ matrix.arch }}"
cp "$BINARY_PATH" "$OUTPUT_NAME"
file "$OUTPUT_NAME"
ls -lh "$OUTPUT_NAME"
echo "binary_name=$OUTPUT_NAME" >> $GITHUB_OUTPUT
- name: Upload to release assets
run: |
gh release upload \
--repo ${{ github.repository }} \
${{ github.event.release.tag_name }} \
${{ steps.prepare.outputs.binary_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
freebsd-bin:
name: FreeBSD binary ${{ matrix.freebsd_version }}-x86
needs: frontend
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
fail-fast: false
matrix:
freebsd_version:
- "14"
- "15"
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
ref: ${{ github.event.release.tag_name }}
- name: Set version environment variable
run: |
RELEASE_TAG="${{ github.event.release.tag_name }}"
echo "RELEASE_VERSION=${RELEASE_TAG#v}" >> $GITHUB_ENV
- name: Download frontend artifact
uses: actions/download-artifact@v4
with:
name: frontend-pages
path: src/
- name: Install dependencies and Build on FreeBSD ${{ matrix.freebsd_version }}.0
uses: vmactions/freebsd-vm@v1
with:
release: "${{ matrix.freebsd_version }}.0"
usesh: true
prepare: |
echo "=== FreeBSD version ==="
uname -r
echo "=== Install dependencies ==="
pkg install -y gmake pkgconf cmake
run: |
cd $GITHUB_WORKSPACE
echo "=== Build binary ==="
mkdir -p build && cd build
RELEASE_VERSION="${{ env.RELEASE_VERSION }}" cmake "${GITHUB_WORKSPACE}" \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_AGGRESSIVE_OPT=ON \
-DCMAKE_SYSTEM_NAME=FreeBSD
cmake --build . -j$(getconf _NPROCESSORS_ONLN)
echo "=== Verify binary ==="
file rtp2httpd
ldd rtp2httpd || true
echo "=== Stage binary ==="
DESTDIR="${GITHUB_WORKSPACE}/staging" cmake --install . --strip
echo "=== Verify Stage binary ==="
file ${GITHUB_WORKSPACE}/staging/usr/local/bin/rtp2httpd
ldd ${GITHUB_WORKSPACE}/staging/usr/local/bin/rtp2httpd || true
- name: Prepare release artifact
id: prepare
run: |
BINARY_SRC="staging/usr/local/bin/rtp2httpd"
BINARY_DST="rtp2httpd-${RELEASE_VERSION}-freebsd${{ matrix.freebsd_version }}-x86_64"
if [ ! -f "$BINARY_SRC" ]; then
echo "Error: Binary not found at $BINARY_SRC"
exit 1
fi
cp "$BINARY_SRC" "$BINARY_DST"
file "$BINARY_DST"
ls -lh "$BINARY_DST"
echo "binary_name=$BINARY_DST" >> $GITHUB_OUTPUT
- name: Upload to release assets
run: |
gh release upload \
--repo ${{ github.repository }} \
${{ github.event.release.tag_name }} \
${{ steps.prepare.outputs.binary_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}