mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-07 12:44:15 +08:00
update 2026-09-26 17:00:06
This commit is contained in:
1 parent
97ae9f68da
commit
bcc9ceb04a
4756 files changed
+1670713
No files matched your search
@@ -0,0 +1,107 @@
|
||||
name: build-apk
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
- 'dev-*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
TARGET: x86
|
||||
SUBTARGET: 64
|
||||
PKG_DIR_NAME: luci-app-adguardhome
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: 安装依赖
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential clang flex bison g++ gawk \
|
||||
gcc-multilib g++-multilib gettext git libncurses5-dev libssl-dev \
|
||||
python3-setuptools rsync swig unzip zlib1g-dev file wget zstd jq
|
||||
|
||||
- name: 下载 SDK
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
echo "🔍 获取 OpenWrt 25.12 最新版本..."
|
||||
LATEST_TAG=$(
|
||||
curl -fsSL https://api.github.com/repos/openwrt/openwrt/releases?per_page=50 \
|
||||
| jq -r '.[].tag_name' \
|
||||
| grep -E '^v25\.12\.[0-9]+(-rc[0-9]+)?$' \
|
||||
| sort -V \
|
||||
| tail -n 1
|
||||
)
|
||||
|
||||
if [[ -z "${LATEST_TAG}" || "${LATEST_TAG}" == "null" ]]; then
|
||||
echo "❌ 获取 OpenWrt 25.12.x tag 失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RELEASE="${LATEST_TAG#v}"
|
||||
echo "检测到 25.12 系列最新版本: ${RELEASE}"
|
||||
|
||||
echo "📥 下载 SDK..."
|
||||
BASE="https://downloads.openwrt.org/releases/${RELEASE}/targets/${TARGET}/${SUBTARGET}/"
|
||||
SDK_TARBALL=$(curl -fsSL "$BASE" | grep -o 'openwrt-sdk-[^"]*\.tar\.zst' | head -n1)
|
||||
mkdir -p _sdk
|
||||
wget -q "${BASE}${SDK_TARBALL}" -O _sdk/sdk.tar.zst
|
||||
tar --zstd -xf _sdk/sdk.tar.zst -C _sdk
|
||||
SDK_DIR="$(find "$PWD/_sdk" -maxdepth 1 -type d -name 'openwrt-sdk-*' -print -quit)"
|
||||
echo "SDK_DIR=${SDK_DIR}" >> "$GITHUB_ENV"
|
||||
echo "✅ SDK 已解压到: ${SDK_DIR}"
|
||||
|
||||
- name: 构建包
|
||||
run: |
|
||||
cd "$SDK_DIR"
|
||||
|
||||
mkdir -p package/${PKG_DIR_NAME}
|
||||
rsync -a --delete "$GITHUB_WORKSPACE/" "package/${PKG_DIR_NAME}/" \
|
||||
--exclude '.git*' --exclude '_sdk'
|
||||
|
||||
./scripts/feeds update -a
|
||||
./scripts/feeds install luci-base tar
|
||||
|
||||
touch .config
|
||||
sed -i -E '/^(# )?CONFIG_(ALL|ALL_KMODS|ALL_NONSHARED|PACKAGE_TAR_XZ|PACKAGE_luci-app-adguardhome)(=| is not set)/d' .config
|
||||
printf '%s\n' \
|
||||
'CONFIG_ALL=n' \
|
||||
'CONFIG_ALL_KMODS=n' \
|
||||
'CONFIG_ALL_NONSHARED=n' \
|
||||
'# CONFIG_PACKAGE_TAR_XZ is not set' \
|
||||
'CONFIG_PACKAGE_luci-app-adguardhome=y' >> .config
|
||||
make defconfig
|
||||
if ! grep -Eq '^CONFIG_PACKAGE_luci-app-adguardhome=(y|m)$' .config; then
|
||||
echo '::error::luci-app-adguardhome was not enabled after make defconfig'
|
||||
grep -n 'luci-app-adguardhome' .config || true
|
||||
sed -n '/^[[:space:]]*config PACKAGE_luci-app-adguardhome$/,/^[[:space:]]*help/p' tmp/.config-package.in
|
||||
exit 1
|
||||
fi
|
||||
|
||||
make package/compile -j"$(nproc)" V=sc
|
||||
|
||||
- name: 上传产物
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: pkg-${{ github.ref_name }}
|
||||
path: _sdk/**/bin/packages/**/${{ env.PKG_DIR_NAME }}*
|
||||
if-no-files-found: error
|
||||
|
||||
- name: 发布到 Releases
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
prerelease: ${{ startsWith(github.ref_name, 'dev-') }}
|
||||
make_latest: ${{ startsWith(github.ref_name, 'dev-') && 'false' || 'true' }}
|
||||
files: _sdk/**/bin/packages/**/${{ env.PKG_DIR_NAME }}*
|
||||
Reference in new issue
Block a user