fix: Support .apk package format in GitHub Actions workflows
GitHub Actions workflow hardcoded .ipk extension, causing artifacts to fail for OpenWrt 25.12+ which uses .apk format. Updated all package handling to dynamically detect format based on OpenWrt version. **Changes:** 1. **Package Format Detection:** - Detect apk (25.12+/SNAPSHOT) vs ipk (24.10 and earlier) in each step - Set PKG_EXT variable based on OPENWRT_VERSION environment variable 2. **Download Dependencies Step:** - Removed broken env.PKG_EXT reference (set before variable exists) - Add local detection of package format - Download correct package index (APKINDEX.tar.gz vs Packages) 3. **Publish Artifacts Step:** - Detect format and copy *.apk or *.ipk files accordingly - Use dynamic PKG_EXT in archive creation - Update package counting to support both formats 4. **Upload Artifacts:** - Renamed from "secubox-all-ipk" to "secubox-all-packages" - Upload both *.ipk and *.apk patterns 5. **Release Step:** - Update package listing to find both .ipk and .apk files - Update sed pattern to handle both naming formats - Add separate installation instructions for apk vs opkg 6. **Build Summary:** - Count both .ipk and .apk files in summary - Fix stdout redirect for package list **Installation Instructions Updated:** - Added separate sections for apk (25.12+) and opkg (24.10) - Clear commands for each package manager **Tested Formats:** - ✅ OpenWrt 25.12.0-rc1: .apk files - ✅ OpenWrt 24.10.5: .ipk files - ✅ OpenWrt 23.05.5: .ipk files - ✅ SNAPSHOT: .apk files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
acdc7bc8d2
commit
c7ab10bd66
71
.github/workflows/build-openwrt-packages.yml
vendored
71
.github/workflows/build-openwrt-packages.yml
vendored
@ -436,7 +436,13 @@ jobs:
|
||||
# OpenWrt package repository base URL
|
||||
VERSION="${{ env.OPENWRT_VERSION }}"
|
||||
ARCH="${{ matrix.arch }}"
|
||||
PKG_EXT="${{ env.PKG_EXT }}"
|
||||
|
||||
# Detect package format based on OpenWrt version
|
||||
if [[ "$VERSION" =~ ^25\. ]] || [[ "$VERSION" == "SNAPSHOT" ]]; then
|
||||
PKG_EXT="apk"
|
||||
else
|
||||
PKG_EXT="ipk"
|
||||
fi
|
||||
|
||||
# Skip for RC versions as repos may not be stable
|
||||
if [[ "$VERSION" =~ -rc ]]; then
|
||||
@ -648,7 +654,7 @@ jobs:
|
||||
echo "### Built Packages" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
ls artifacts/${{ matrix.target }}/*.$PKG_EXT 2>/dev/null | xargs -I{} basename {} | sort
|
||||
ls artifacts/${{ matrix.target }}/*.$PKG_EXT 2>/dev/null | xargs -I{} basename {} | sort >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
|
||||
@ -671,8 +677,18 @@ jobs:
|
||||
run: |
|
||||
VERSION="${{ needs.setup.outputs.version }}"
|
||||
PACKAGE_NAME="${{ github.event.inputs.package_name }}"
|
||||
OPENWRT_VERSION="${{ env.OPENWRT_VERSION }}"
|
||||
mkdir -p release
|
||||
|
||||
# Detect package format based on OpenWrt version
|
||||
if [[ "$OPENWRT_VERSION" =~ ^25\. ]] || [[ "$OPENWRT_VERSION" == "SNAPSHOT" ]]; then
|
||||
PKG_EXT="apk"
|
||||
else
|
||||
PKG_EXT="ipk"
|
||||
fi
|
||||
|
||||
echo "📦 Package format: .$PKG_EXT"
|
||||
|
||||
# Determine prefix for archives
|
||||
if [[ -n "$PACKAGE_NAME" ]]; then
|
||||
PREFIX="${PACKAGE_NAME}"
|
||||
@ -689,12 +705,12 @@ jobs:
|
||||
ARCH=$(basename "$dir" | sed 's/packages-//')
|
||||
echo "📦 $ARCH"
|
||||
|
||||
# Copy .ipk files to release
|
||||
# Copy package files (.apk or .ipk) to release
|
||||
mkdir -p "release/${ARCH}"
|
||||
cp "$dir"/*.ipk "release/${ARCH}/" 2>/dev/null || true
|
||||
cp "$dir"/*.$PKG_EXT "release/${ARCH}/" 2>/dev/null || true
|
||||
|
||||
# Create archive
|
||||
if ls "release/${ARCH}"/*.ipk >/dev/null 2>&1; then
|
||||
if ls "release/${ARCH}"/*.$PKG_EXT >/dev/null 2>&1; then
|
||||
tar -czf "release/${PREFIX}-${VERSION}-${ARCH}.tar.gz" -C "release/${ARCH}" .
|
||||
fi
|
||||
done
|
||||
@ -714,7 +730,7 @@ jobs:
|
||||
echo "📊 Package count per architecture:"
|
||||
for dir in */; do
|
||||
[[ -d "$dir" ]] || continue
|
||||
COUNT=$(ls "$dir"/*.ipk 2>/dev/null | wc -l)
|
||||
COUNT=$(ls "$dir"/*.$PKG_EXT 2>/dev/null | wc -l)
|
||||
echo " ${dir%/}: $COUNT packages"
|
||||
done
|
||||
|
||||
@ -727,11 +743,13 @@ jobs:
|
||||
release/SHA256SUMS
|
||||
retention-days: 90
|
||||
|
||||
- name: Upload individual .ipk files
|
||||
- name: Upload individual package files
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: secubox-all-ipk-${{ needs.setup.outputs.version }}
|
||||
path: release/*/*.ipk
|
||||
name: secubox-all-packages-${{ needs.setup.outputs.version }}
|
||||
path: |
|
||||
release/*/*.ipk
|
||||
release/*/*.apk
|
||||
retention-days: 90
|
||||
|
||||
# ============================================
|
||||
@ -752,21 +770,21 @@ jobs:
|
||||
name: secubox-release-${{ needs.setup.outputs.version }}
|
||||
path: release
|
||||
|
||||
- name: Download all .ipk files
|
||||
- name: Download all package files
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: secubox-all-ipk-${{ needs.setup.outputs.version }}
|
||||
path: ipk-files
|
||||
name: secubox-all-packages-${{ needs.setup.outputs.version }}
|
||||
path: package-files
|
||||
continue-on-error: true
|
||||
|
||||
- name: List packages
|
||||
id: list-packages
|
||||
run: |
|
||||
echo "📦 Packages in release:"
|
||||
find . -name "*.ipk" -exec basename {} \; | sort -u
|
||||
|
||||
find . \( -name "*.ipk" -o -name "*.apk" \) -exec basename {} \; | sort -u
|
||||
|
||||
# Count unique packages
|
||||
PKG_LIST=$(find . -name "*.ipk" -exec basename {} \; | sort -u | sed 's/_[0-9].*//g' | sort -u | tr '\n' ', ' | sed 's/,$//')
|
||||
PKG_LIST=$(find . \( -name "*.ipk" -o -name "*.apk" \) -exec basename {} \; | sort -u | sed 's/_[0-9].*//g' | sed 's/-[0-9].*//g' | sort -u | tr '\n' ', ' | sed 's/,$//')
|
||||
echo "packages=$PKG_LIST" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create GitHub Release
|
||||
@ -786,14 +804,23 @@ jobs:
|
||||
${{ steps.list-packages.outputs.packages }}
|
||||
|
||||
### 📥 Installation
|
||||
|
||||
|
||||
**For OpenWrt 25.12+ (.apk format):**
|
||||
```bash
|
||||
# Download the archive for your architecture
|
||||
# Extract and upload .ipk files to router
|
||||
|
||||
# Upload .apk files to router
|
||||
apk update
|
||||
apk add /tmp/luci-app-*.apk
|
||||
|
||||
# Restart services
|
||||
/etc/init.d/rpcd restart
|
||||
```
|
||||
|
||||
**For OpenWrt 24.10 and earlier (.ipk format):**
|
||||
```bash
|
||||
# Upload .ipk files to router
|
||||
opkg update
|
||||
opkg install /tmp/luci-app-*.ipk
|
||||
|
||||
|
||||
# Restart services
|
||||
/etc/init.d/rpcd restart
|
||||
```
|
||||
@ -866,9 +893,9 @@ jobs:
|
||||
for dir in packages/packages-*/; do
|
||||
if [[ -d "$dir" ]]; then
|
||||
ARCH=$(basename "$dir" | sed 's/packages-//')
|
||||
COUNT=$(find "$dir" -name "*.ipk" 2>/dev/null | wc -l)
|
||||
COUNT=$(find "$dir" \( -name "*.ipk" -o -name "*.apk" \) 2>/dev/null | wc -l)
|
||||
TOTAL=$((TOTAL + COUNT))
|
||||
|
||||
|
||||
if [[ $COUNT -gt 0 ]]; then
|
||||
echo "| $ARCH | ✅ Success | $COUNT |" >> $GITHUB_STEP_SUMMARY
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user