fix(ci): Update publish workflow to use individual ipk files

The release contains individual ipk files, not architecture-specific
tarballs. Update the workflow to:

- Download all *.ipk files from the release
- Copy packages to all architecture directories (most SecuBox packages
  are architecture-independent LuCI/shell packages)
- Simplify the repository structure creation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-03-20 10:33:13 +01:00
parent f447f62b13
commit f9d1fee08e

View File

@ -42,7 +42,7 @@ jobs:
VERSION_NUM="${VERSION#v}"
echo "version_num=$VERSION_NUM" >> $GITHUB_OUTPUT
- name: Download package tarballs from release
- name: Download packages from release
env:
GH_TOKEN: ${{ github.token }}
run: |
@ -50,36 +50,18 @@ jobs:
cd downloads
VERSION="${{ steps.version.outputs.version }}"
VERSION_NUM="${{ steps.version.outputs.version_num }}"
echo "Downloading packages from release $VERSION..."
# Architecture-specific packages
ARCHITECTURES=(
"x86-64:x86_64"
"aarch64-generic:aarch64_generic"
"aarch64-cortex-a72:aarch64_cortex-a72"
"aarch64-cortex-a53:aarch64_cortex-a53"
"rockchip-armv8:aarch64_generic"
"bcm27xx-bcm2711:aarch64_cortex-a72"
"mediatek-filogic:aarch64_cortex-a53"
"mips-24kc:mips_24kc"
"mipsel-24kc:mipsel_24kc"
)
# Download all ipk files from the release
gh release download "$VERSION" -p "*.ipk" || {
echo "No ipk files found in release"
exit 1
}
for arch_map in "${ARCHITECTURES[@]}"; do
ARCH="${arch_map%%:*}"
OPKG_ARCH="${arch_map##*:}"
TARBALL="secubox-${VERSION_NUM}-${ARCH}.tar.gz"
echo "Downloading $TARBALL for opkg arch $OPKG_ARCH..."
gh release download "$VERSION" -p "$TARBALL" || echo "Skipping $TARBALL (not found)"
done
# All-architectures package (LuCI apps, configs)
gh release download "$VERSION" -p "secubox-${VERSION_NUM}-all-architectures.tar.gz" || true
ls -lh
echo "Downloaded packages:"
ls -lh *.ipk | wc -l
echo "packages total"
- name: Create repository structure
run: |
@ -87,78 +69,43 @@ jobs:
mkdir -p repo/luci
mkdir -p repo/catalog
VERSION_NUM="${{ steps.version.outputs.version_num }}"
# Architecture mappings
declare -A ARCH_MAP=(
["x86-64"]="x86_64"
["aarch64-generic"]="aarch64_generic"
["aarch64-cortex-a72"]="aarch64_cortex-a72"
["aarch64-cortex-a53"]="aarch64_cortex-a53"
["rockchip-armv8"]="aarch64_generic"
["bcm27xx-bcm2711"]="aarch64_cortex-a72"
["mediatek-filogic"]="aarch64_cortex-a53"
["mips-24kc"]="mips_24kc"
["mipsel-24kc"]="mipsel_24kc"
# All supported architectures - packages with _all.ipk work for all
ARCHITECTURES=(
"x86_64"
"aarch64_generic"
"aarch64_cortex-a72"
"aarch64_cortex-a53"
"mips_24kc"
"mipsel_24kc"
)
# Extract and organize packages
for ARCH in "${!ARCH_MAP[@]}"; do
OPKG_ARCH="${ARCH_MAP[$ARCH]}"
TARBALL="downloads/secubox-${VERSION_NUM}-${ARCH}.tar.gz"
if [ -f "$TARBALL" ]; then
echo "Processing $TARBALL -> $OPKG_ARCH"
# Create arch directories
mkdir -p "repo/packages/${OPKG_ARCH}"
mkdir -p "repo/luci/${OPKG_ARCH}"
# Extract to temp
TMPDIR=$(mktemp -d)
tar -xzf "$TARBALL" -C "$TMPDIR"
# Move LuCI packages to luci/ and others to packages/
find "$TMPDIR" -name '*.ipk' | while read pkg; do
PKG_NAME=$(basename "$pkg")
if [[ "$PKG_NAME" == luci-* ]]; then
cp "$pkg" "repo/luci/${OPKG_ARCH}/"
else
cp "$pkg" "repo/packages/${OPKG_ARCH}/"
fi
done
rm -rf "$TMPDIR"
fi
# Create directories for each architecture
for OPKG_ARCH in "${ARCHITECTURES[@]}"; do
mkdir -p "repo/packages/${OPKG_ARCH}"
mkdir -p "repo/luci/${OPKG_ARCH}"
done
# Handle all-architectures tarball (architecture-independent packages)
ALL_TARBALL="downloads/secubox-${VERSION_NUM}-all-architectures.tar.gz"
if [ -f "$ALL_TARBALL" ]; then
echo "Processing all-architectures packages..."
TMPDIR=$(mktemp -d)
tar -xzf "$ALL_TARBALL" -C "$TMPDIR"
# Categorize and copy packages
echo "Organizing packages..."
for ipk in downloads/*.ipk; do
[ -f "$ipk" ] || continue
PKG_NAME=$(basename "$ipk")
# Copy all-arch packages to each architecture directory
for OPKG_ARCH in "x86_64" "aarch64_generic" "aarch64_cortex-a72" "aarch64_cortex-a53" "mips_24kc" "mipsel_24kc"; do
if [ -d "repo/packages/${OPKG_ARCH}" ]; then
find "$TMPDIR" -name '*.ipk' | while read pkg; do
PKG_NAME=$(basename "$pkg")
# Skip if architecture-specific version exists
if [ ! -f "repo/packages/${OPKG_ARCH}/${PKG_NAME}" ] && \
[ ! -f "repo/luci/${OPKG_ARCH}/${PKG_NAME}" ]; then
if [[ "$PKG_NAME" == luci-* ]]; then
cp "$pkg" "repo/luci/${OPKG_ARCH}/" 2>/dev/null || true
else
cp "$pkg" "repo/packages/${OPKG_ARCH}/" 2>/dev/null || true
fi
fi
done
fi
# Determine if it's a LuCI package
if [[ "$PKG_NAME" == luci-* ]]; then
TARGET_DIR="repo/luci"
else
TARGET_DIR="repo/packages"
fi
# Copy to all architecture directories
# (OpenWrt packages are typically arch-independent for LuCI/shell packages)
for OPKG_ARCH in "${ARCHITECTURES[@]}"; do
cp "$ipk" "${TARGET_DIR}/${OPKG_ARCH}/"
done
rm -rf "$TMPDIR"
fi
done
echo ""
echo "Repository structure:"
find repo -type d
echo ""