Skip to content

update to most recent version #63

update to most recent version

update to most recent version #63

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@v4
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@v4
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"