Skip to content

Build 24.10 Single Machine #84

Build 24.10 Single Machine

Build 24.10 Single Machine #84

name: Build 24.10 Single Machine
# Fix for broken build: https://github.com/softprops/action-gh-release/issues/236
permissions:
contents: write
actions: write
on:
repository_dispatch:
workflow_dispatch:
inputs:
Cache:
description: 'Use Cache'
required: true
default: 'true'
type: choice
options:
- 'true'
- 'false'
ALLKMOD:
description: 'Compile All Kmods'
required: true
default: 'true'
type: choice
options:
- 'true'
- 'false'
UPLOAD_RELEASE:
description: 'UPLOAD To RELEASE'
required: true
default: 'true'
type: choice
options:
- 'true'
- 'false'
MACH:
description: 'Choose machine'
required: true
default: 'rax3000m-emmc'
type: choice
options:
- 'rax3000m-emmc'
- 'rax3000m-nand'
- 'nokia_ea0326gmp_ubootmod'
- 'nokia_ea0326gmp_stock'
- 'lenovo_newifi-d1'
- 'd-team_newifi-d2'
- 'lenovo_newifi-y1'
- 'domywifi_dw33d'
- 'aliyun_ap8220'
TRY_BBR_V3:
description: 'Update BBR TO V3'
default: 'false'
type: choice
options:
- 'true'
- 'false'
AG71XX_FIX:
description: 'Fix ag71xx'
default: 'false'
type: choice
options:
- 'true'
- 'false'
SFE_BUILDIN:
description: 'Build sfe'
default: 'true'
type: choice
options:
- 'true'
- 'false'
# TEST-KERNEL:
# description: 'Use kernel 6.1'
# default: 'false'
# type: choice
# options:
# - 'true'
# - 'false'
# USE_52MHZ:
# description: 'Use 52MHz max-frequency'
# default: 'false'
# type: choice
# options:
# - 'true'
# - 'false'
SETIP:
description: 'Set ip address'
default: '192.168.10.1'
required: false
type: choice
options:
- '192.168.10.1'
- '192.168.8.1'
- '192.168.7.1'
- '192.168.17.1'
- '192.168.16.1'
- '192.168.19.1'
- '192.168.12.1'
- '192.168.99.1'
- '192.168.166.1'
- '172.16.0.1'
- '172.18.0.1'
- '10.0.0.1'
- '10.88.0.1'
env:
TZ: Asia/Shanghai
jobs:
prepare:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
strategy:
matrix:
include:
- mt798x: rax3000m-emmc
- mt798x: rax3000m-nand
- mt798x-nousb: nokia_ea0326gmp_ubootmod
- mt798x-nousb: nokia_ea0326gmp_stock
- ramips: lenovo_newifi-d1
- ramips: lenovo_newifi-y1
- ramips: d-team_newifi-d2
- ath79: domywifi_dw33d
- ipq: aliyun_ap8220
steps:
- name: 检查
uses: actions/checkout@main
- name: 生成矩阵配置
id: set-matrix
run: |
if [ "${{ github.event.inputs.MACH }}" == "${{ matrix.mt798x }}" ]; then
matrix={\"include\":[{\"target\":\"mt798x-iptables\"},{\"target\":\"mt798x-nftables\"}]}
elif [ "${{ github.event.inputs.MACH }}" == "${{ matrix.mt798x-nousb }}" ]; then
matrix={\"include\":[{\"target\":\"mt798x-nousb-iptables\"},{\"target\":\"mt798x-nousb-nftables\"}]}
elif [ "${{ github.event.inputs.MACH }}" == "${{ matrix.ramips }}" ]; then
matrix={\"include\":[{\"target\":\"ramips-iptables\"},{\"target\":\"ramips-nftables\"}]}
elif [ "${{ github.event.inputs.MACH }}" == "${{ matrix.ath79 }}" ]; then
matrix={\"include\":[{\"target\":\"ath79-iptables\"},{\"target\":\"ath79-nftables\"}]}
elif [ "${{ github.event.inputs.MACH }}" == "${{ matrix.ipq }}" ]; then
matrix={\"include\":[{\"target\":\"ipq-iptables\"},{\"target\":\"ipq-nftables\"}]}
fi
echo "Generated matrix: "$matrix""
echo "matrix=$matrix" >> $GITHUB_OUTPUT
build:
runs-on: Ubuntu-22.04
needs: prepare
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
name: Build ${{github.event.inputs.MACH}} openwrt 24.10
steps:
- name: 检查
uses: actions/checkout@main
- name: Print matrix from prepare
run: |
echo "::notice ::Matrix from prepare: ${{ needs.prepare.outputs.matrix }}"
- name: 释放Ubuntu磁盘空间
uses: endersonmenezes/free-disk-space@v2
with:
remove_android: true
remove_dotnet: true
remove_haskell: true
remove_tool_cache: true
remove_swap: true
remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
remove_packages_one_command: true
remove_folders: "/usr/share/swift /usr/share/miniconda /usr/share/az* /usr/share/glade* /usr/local/lib/node_modules /usr/local/share/chromium /usr/local/share/powershell"
testing: false
- name: 初始化环境
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo -E apt-get -qq update
sudo -E apt-get -qq install build-essential clang flex g++ gawk gcc-multilib gettext \
git libncurses5-dev libssl-dev python3-distutils python3-pyelftools python3-setuptools \
libpython3-dev rsync unzip zlib1g-dev swig aria2 jq subversion qemu-utils ccache rename \
libelf-dev device-tree-compiler libgnutls28-dev coccinelle libgmp3-dev libmpc-dev libfuse-dev b43-fwcutter cups-ppdc
sudo -E apt-get -qq purge azure-cli ghc* zulu* llvm* firefox powershell openjdk* dotnet* google* mysql* php* android*
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo timedatectl set-timezone "$TZ"
sudo mkdir -p /workdir
sudo chown $USER:$GROUPS /workdir
- name: 设置GITHUB_ENV
id: env
run: |
echo "date=$(date +'%m/%d_%Y_%H/%M')" >> $GITHUB_ENV
echo "date2=$(date +'%Y/%m %d')" >> $GITHUB_ENV
echo "date3=$(date +'%m.%d')" >> $GITHUB_ENV
VERSION="$(echo "${{github.event.action}}" | grep -Eo " [0-9.]+" | sed -e 's/ //')" || true
[ "$VERSION" ] && echo "VERSION=$VERSION" >> $GITHUB_ENV || echo "VERSION=$(date +'%m.%d')" >> $GITHUB_ENV
echo ${{matrix.target}}
source "${GITHUB_WORKSPACE}/env/common.txt"
source "${GITHUB_WORKSPACE}/env/openwrt-24.10.repo"
echo "REPO_URL=${REPO_URL}" >> $GITHUB_ENV
echo "BURN_UBOOT_IMG_URL=${BURN_UBOOT_IMG_URL}" >> $GITHUB_ENV
echo "AMLIMG_TOOL_URL=${AMLIMG_TOOL_URL}" >> $GITHUB_ENV
echo "REPO_BRANCH=${REPO_BRANCH}" >> $GITHUB_ENV
echo "DIY_SH=${DIY_SH}" >> $GITHUB_ENV
echo "DIY_SH_AFB=${DIY_SH_AFB}" >> $GITHUB_ENV
echo "DIY_SH_RFC=${DIY_SH_RFC}" >> $GITHUB_ENV
echo "UPLOAD_BIN_DIR=${UPLOAD_BIN_DIR}" >> $GITHUB_ENV
echo "UPLOAD_IPK_DIR=${UPLOAD_IPK_DIR}" >> $GITHUB_ENV
echo "UPLOAD_FIRMWARE=${UPLOAD_FIRMWARE}" >> $GITHUB_ENV
echo "UPLOAD_COWTRANSFER=${UPLOAD_COWTRANSFER}" >> $GITHUB_ENV
echo "UPLOAD_WETRANSFER=${UPLOAD_WETRANSFER}" >> $GITHUB_ENV
echo "UPLOAD_RELEASE=${UPLOAD_RELEASE}" >> $GITHUB_ENV
echo "UPLOAD_ALLKMOD=${UPLOAD_ALLKMOD}" >> $GITHUB_ENV
echo "UPLOAD_SYSUPGRADE=${UPLOAD_SYSUPGRADE}" >> $GITHUB_ENV
echo "USE_Cache=${USE_Cache}" >> $GITHUB_ENV
#if [ ${{github.event.inputs.TEST-KERNEL}} = true ]; then
#echo "Kernel_Test=_Kernel_Test_Ver" >> $GITHUB_ENV
#fi
chmod +x $DIY_SH $DIY_SH_AFB $DIY_SH_RFC gen-sha256sum.sh add-test-packages.sh add-sfe-packages.sh
- name: 导入机器及安装包config
run: |
if [ ${{github.event.inputs.TEST-KERNEL}} = true ]; then
$GITHUB_WORKSPACE/$DIY_SH add-test-config
fi
if [ ${{matrix.target}} == 'mt798x-nftables' ] || [ ${{ matrix.target }} == 'mt798x-nousb-nftables' ] || [ ${{ matrix.target }} == 'ramips-nftables' ] || [ ${{ matrix.target }} == 'ath79-nftables' ] || [ ${{ matrix.target }} == 'ipq-nftables' ]; then
bash $GITHUB_WORKSPACE/add-test-packages.sh nft
echo "----${{matrix.target}}-----NFT-test---"
fi
if [ ${{matrix.target}} == 'mt798x-iptables' ] || [ ${{ matrix.target }} == 'mt798x-nousb-iptables' ] || [ ${{ matrix.target }} == 'ramips-iptables' ] || [ ${{ matrix.target }} == 'ath79-iptables' ] || [ ${{ matrix.target }} == 'ipq-iptables' ]; then
mv -f machine-configs/single/${{github.event.inputs.MACH}}-iptables.config machine-configs/${{matrix.target}}.config
echo "----${{matrix.target}}-----IPT-Machine--------"
elif [ ${{matrix.target}} == 'mt798x-nftables' ] || [ ${{ matrix.target }} == 'mt798x-nousb-nftables' ] || [ ${{ matrix.target }} == 'ramips-nftables' ] || [ ${{ matrix.target }} == 'ath79-nftables' ] || [ ${{ matrix.target }} == 'ipq-nftables' ]; then
mv -f machine-configs/single/${{github.event.inputs.MACH}}-nftables.config machine-configs/${{matrix.target}}.config
echo "----${{matrix.target}}-----NFT-Machine--------"
fi
if [ ${{matrix.target}} == 'mt798x-iptables' ]; then
mv -f package-configs/single/${{github.event.inputs.MACH}}-iptables.config package-configs/mt798x-common-iptables.config
echo "----${{matrix.target}}-----IPT-Package-Config----"
elif [ ${{matrix.target}} == 'mt798x-nftables' ]; then
mv -f package-configs/single/${{github.event.inputs.MACH}}-nftables.config package-configs/mt798x-common-nftables.config
echo "----${{matrix.target}}-----NFT-Package-Config----"
elif [ ${{ matrix.target }} == 'mt798x-nousb-nftables' ]; then
mv -f package-configs/single/${{github.event.inputs.MACH}}-nftables.config package-configs/mt798x-nousb-nftables.config
echo "----${{matrix.target}}-----NFT-Package-Config----"
elif [ ${{ matrix.target }} == 'mt798x-nousb-iptables' ]; then
mv -f package-configs/single/${{github.event.inputs.MACH}}-iptables.config package-configs/mt798x-nousb-iptables.config
echo "----${{matrix.target}}-----IPT-Package-Config----"
elif [ ${{matrix.target}} == 'ramips-iptables' ]; then
mv -f package-configs/single/${{github.event.inputs.MACH}}-iptables.config package-configs/ramips-common-iptables.config
echo "----${{matrix.target}}-----IPT-Package-Config----"
elif [ ${{matrix.target}} == 'ramips-nftables' ]; then
mv -f package-configs/single/${{github.event.inputs.MACH}}-nftables.config package-configs/ramips-common-nftables.config
echo "----${{matrix.target}}-----NFT-Package-Config----"
elif [ ${{matrix.target}} == 'ath79-iptables' ]; then
mv -f package-configs/single/${{github.event.inputs.MACH}}-iptables.config package-configs/ath79-common-iptables.config
echo "----${{matrix.target}}-----IPT-Package-Config----"
elif [ ${{matrix.target}} == 'ath79-nftables' ]; then
mv -f package-configs/single/${{github.event.inputs.MACH}}-nftables.config package-configs/ath79-common-nftables.config
echo "----${{matrix.target}}-----NFT-Package-Config----"
elif [ ${{matrix.target}} == 'ipq-iptables' ]; then
mv -f package-configs/single/${{github.event.inputs.MACH}}-iptables.config package-configs/ipq-common-iptables.config
echo "----${{matrix.target}}-----IPT-Package-Config----"
elif [ ${{matrix.target}} == 'ipq-nftables' ]; then
mv -f package-configs/single/${{github.event.inputs.MACH}}-nftables.config package-configs/ipq-common-nftables.config
echo "----${{matrix.target}}-----NFT-Package-Config----"
fi
- name: 克隆源代码
working-directory: /workdir
id: clone
run: |
df -hT $PWD
git clone $REPO_URL -b $REPO_BRANCH openwrt --single-branch
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
cd openwrt
sed -i '$a src-git lunatic7 https://github.com/lunatickochiya/actionbased-openwrt-packages.git' feeds.conf.default
if [ ${{matrix.target}} == 'mt798x-nftables' ] || [ ${{ matrix.target }} == 'mt798x-nousb-nftables' ] || [ ${{ matrix.target }} == 'ramips-nftables' ] || [ ${{ matrix.target }} == 'ath79-nftables' ] || [ ${{ matrix.target }} == 'ipq-nftables' ]; then
curl -sSL https://raw.githubusercontent.com/chenmozhijin/turboacc/luci/add_turboacc.sh -o add_turboacc.sh && bash add_turboacc.sh
echo "----${{matrix.target}}-----NFT-acc----"
fi
echo "status=success" >> $GITHUB_OUTPUT
- name: 增加磁盘空间
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo mkdir -p -m 777 /mnt/openwrt/dl /mnt/openwrt/bin /mnt/openwrt/staging_dir /mnt/openwrt/build_dir
ln -sf /mnt/openwrt/dl openwrt/dl
ln -sf /mnt/openwrt/bin openwrt/bin
ln -sf /mnt/openwrt/staging_dir openwrt/staging_dir
ln -sf /mnt/openwrt/build_dir openwrt/build_dir
df -hT
ls /mnt/openwrt
- name: Patch 自定义
id: patch
run: |
if [ ${{github.event.inputs.TRY_BBR_V3}} = true ]; then
[ -d openwrt-2410/mypatch-bbr-v3 ] && cp -r openwrt-2410/mypatch-bbr-v3/* openwrt-2410/mypatch-2410-${{matrix.target}}
fi
if [ ${{github.event.inputs.AG71XX_FIX}} = true ]; then
[ -d openwrt-2410/my-patch-ag71xx-fix ] && cp -r openwrt-2410/my-patch-ag71xx-fix/* openwrt-2410/mypatch-2410-${{matrix.target}}
fi
echo "status=success" >> $GITHUB_OUTPUT
- name: 添加 SFE
if: github.event.inputs.SFE_BUILDIN == 'true'
id: sfe
run: |
if [ ${{matrix.target}} == 'mt798x-iptables' ] || [ ${{ matrix.target }} == 'mt798x-nousb-iptables' ] || [ ${{ matrix.target }} == 'ramips-iptables' ] || [ ${{ matrix.target }} == 'ath79-iptables' ] || [ ${{ matrix.target }} == 'ipq-iptables' ]; then
bash $GITHUB_WORKSPACE/add-sfe-packages.sh ipt
echo "----${{matrix.target}}-----ipt-sfe---"
cd openwrt
wget -N https://raw.githubusercontent.com/chenmozhijin/turboacc/refs/heads/package/pending-6.6/613-netfilter_optional_tcp_window_check.patch -P target/linux/generic/pending-6.6/
wget -N https://raw.githubusercontent.com/chenmozhijin/turboacc/refs/heads/package/hack-6.6/952-add-net-conntrack-events-support-multiple-registrant.patch -P target/linux/generic/hack-6.6/
wget -N https://raw.githubusercontent.com/chenmozhijin/turboacc/refs/heads/package/hack-6.6/953-net-patch-linux-kernel-to-support-shortcut-fe.patch -P target/linux/generic/hack-6.6/
echo "# CONFIG_NF_CONNTRACK_CHAIN_EVENTS is not set" >> "./target/linux/generic/config-6.6"
echo "# CONFIG_SHORTCUT_FE is not set" >> "./target/linux/generic/config-6.6"
# git clone https://github.com/lunatickochiya/luci-app-turboacc-js package/luci-app-turboacc-js && sed -i 's?\.\./\.\./luci.mk?$(TOPDIR)/feeds/luci/luci.mk?' ./package/luci-app-turboacc-js/Makefile ; rm -rf ./package/luci-app-turboacc-js/.git/
git clone --depth=1 --single-branch --branch "package" https://github.com/chenmozhijin/turboacc && mv -n turboacc/shortcut-fe ./package ; rm -rf turboacc
cd ../
fi
sed -i 's/kmod-shortcut-fe-cm,kmod-shortcut-fe,kmod-fast-classifier,kmod-fast-classifier-noload,kmod-shortcut-fe-drv,//g' package-configs/kmod_exclude_list*
# sed -i 's/"feeds\/lunatic7\/shortcut-fe"//g' diy-2410.sh
# sed -i 's/"feeds\/lunatic7\/luci-app-turboacc"//g' diy-2410.sh
echo "status=success" >> $GITHUB_OUTPUT
- name: 自定义安装包(优先于feeds)
if: steps.clone.outputs.status == 'success'
id: files
run: |
[ -d package ] && mv -f package/* openwrt/package
[ -d openwrt-2410/package-for-mt798x ] && mv -f openwrt-2410/package-for-mt798x/* openwrt/package
[ -d openwrt-2410/package-for-2410 ] && cp -r openwrt-2410/package-for-2410/* openwrt/package
[ -d openwrt-2410/mypatch-2410 ] && mv -f openwrt-2410/mypatch-2410 openwrt/mypatch-2410
[ -d openwrt-2410/mypatch-2410-${{matrix.target}} ] && mv -f openwrt-2410/mypatch-2410-${{matrix.target}} openwrt/mypatch
cd openwrt
$GITHUB_WORKSPACE/$DIY_SH patch-openwrt
cd ../
echo "status=success" >> $GITHUB_OUTPUT
- name: 设置 dts 闪存频率
if: github.event.inputs.USE_52MHZ == 'true'
id: frequency
run: |
sed -i -e '/bus-width = <8>;/ a\ cap-mmc-highspeed;' openwrt/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc-ubootmod.dts
sed -i 's/26000000/52000000/g' openwrt/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc-ubootmod.dts
grep max-frequency openwrt/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc-ubootmod.dts
echo "status=success" >> $GITHUB_OUTPUT
- name: 设置 IP 地址
if: github.event.inputs.SETIP != '192.168.10.1'
id: setip
run: |
IPSET_VALUE="${{ github.event.inputs.SETIP }}"
sed -i "s/192\.168\.10\.1/$IPSET_VALUE/g" openwrt/package/kochiya/autoset/files/zzz-autoset-mediatek
sed -i "s/192\.168\.10\.1/$IPSET_VALUE/g" openwrt/package/kochiya/autoset/files/zzz-autoset-ramips
sed -i "s/192\.168\.10\.1/$IPSET_VALUE/g" openwrt/package/kochiya/autoset/files/zzz-autoset-ath79
sed -i "s/192\.168\.10\.1/$IPSET_VALUE/g" openwrt/package/kochiya/autoset/files/zzz-autoset-ipq
grep 'set network.lan.ipaddr=' openwrt/package/kochiya/autoset/files/zzz-autoset-mediatek
grep 'set network.lan.ipaddr=' openwrt/package/kochiya/autoset/files/zzz-autoset-ramips
grep 'set network.lan.ipaddr=' openwrt/package/kochiya/autoset/files/zzz-autoset-ath79
grep 'set network.lan.ipaddr=' openwrt/package/kochiya/autoset/files/zzz-autoset-ipq
echo "status=success" >> $GITHUB_OUTPUT
- name: 更新 & 安装 feeds
if: steps.files.outputs.status == 'success'
id: feeds
run: |
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
echo "status=success" >> $GITHUB_OUTPUT
- name: 自定义配置(修复feeds)
if: steps.feeds.outputs.status == 'success'
id: config
run: |
if [ ${{github.event.inputs.TEST-KERNEL}} = true ]; then
mv -f openwrt-2410/K61/tele openwrt/feeds/telephony
mv -f openwrt-2410/K61/packages/* openwrt-2410/feeds-package-patch-2410
fi
[ -d openwrt-2410/lunatic7-revert ] && mv -f openwrt-2410/lunatic7-revert openwrt/feeds/lunatic7/lunatic7-revert
[ -d openwrt-2410/luci-patch-2410 ] && mv -f openwrt-2410/luci-patch-2410 openwrt/feeds/luci/luci-patch-2410
[ -d openwrt-2410/feeds-package-patch-2410 ] && mv -f openwrt-2410/feeds-package-patch-2410 openwrt/feeds/packages/feeds-package-patch-2410
[ -e files ] && mv files openwrt/files
[ -e package-configs ] && mv package-configs openwrt/package-configs
[ -e machine-configs/${{matrix.target}}.config ] && mv -f machine-configs/${{matrix.target}}.config openwrt/package-configs/.config
cd openwrt
$GITHUB_WORKSPACE/$DIY_SH ${{matrix.target}}
if [ ${{github.event.inputs.TEST-KERNEL}} = true ]; then
$GITHUB_WORKSPACE/$DIY_SH patchtele
fi
make defconfig
$GITHUB_WORKSPACE/$DIY_SH_RFC ${{matrix.target}}
echo "status=success" >> $GITHUB_OUTPUT
- name: 添加kmod
if: steps.config.outputs.status == 'success' && github.event.inputs.ALLKMOD == 'true'
id: config2
run: |
cd openwrt
if [ ${{matrix.target}} == 'ramips-iptables' ] || [ ${{ matrix.target }} == 'ramips-nftables' ]; then
$GITHUB_WORKSPACE/$DIY_SH_RFC kmod-ramips
make defconfig
$GITHUB_WORKSPACE/$DIY_SH_RFC kmod-ramips
make defconfig
$GITHUB_WORKSPACE/$DIY_SH_RFC kmod-ramips
make defconfig
elif [ ${{matrix.target}} == 'ath79-iptables' ] || [ ${{ matrix.target }} == 'ath79-nftables' ]; then
$GITHUB_WORKSPACE/$DIY_SH_RFC kmod-ath79
make defconfig
$GITHUB_WORKSPACE/$DIY_SH_RFC kmod-ath79
make defconfig
$GITHUB_WORKSPACE/$DIY_SH_RFC kmod-ath79
make defconfig
elif [ ${{matrix.target}} == 'ipq-iptables' ] || [ ${{ matrix.target }} == 'ipq-nftables' ]; then
$GITHUB_WORKSPACE/$DIY_SH_RFC kmod-ipq
make defconfig
$GITHUB_WORKSPACE/$DIY_SH_RFC kmod-ipq
make defconfig
$GITHUB_WORKSPACE/$DIY_SH_RFC kmod-ipq
make defconfig
else
$GITHUB_WORKSPACE/$DIY_SH_RFC kmod
make defconfig
$GITHUB_WORKSPACE/$DIY_SH_RFC kmod
make defconfig
$GITHUB_WORKSPACE/$DIY_SH_RFC kmod
make defconfig
fi
$GITHUB_WORKSPACE/$DIY_SH_RFC ${{matrix.target}}
echo "status=success" >> $GITHUB_OUTPUT
- name: Run awk command
if: steps.config.outputs.status == 'success'
working-directory: ./openwrt
run: |
echo "------------------------"
awk '/CONFIG_LINUX/ { print }' .config
awk '/${{matrix.target}}/ { print }' .config
echo "------------------------"
awk '/${{github.event.inputs.MACH}}/ { print }' .config
echo "------------------------"
awk '/mediatek/ { print }' .config
echo "------------------------"
awk '/wpad/ { print }' .config
echo "------------------------"
awk '/docker/ { print }' .config
echo "------------------------"
awk '/DOCKER/ { print }' .config
echo "------------------------"
awk '/store/ { print }' .config
echo "------------------------"
awk '/perl/ { print }' .config
echo "------------------------"
awk '/dnsmasq/ { print }' .config
echo "------------------------"
awk '/CONFIG_PACKAGE_kmod/ { print }' .config
echo "------------------------"
awk '/mt7981/ { print }' .config
- name: 下载包文件
if: steps.config.outputs.status == 'success'
run: |
cd openwrt
make download -j$(nproc)
find dl -size -1024c -exec rm -f {} \;
- name: 缓存
uses: stupidloud/cachewrtbuild@main
if: github.event.inputs.Cache == 'true' && !cancelled()
with:
ccache: 'true'
mixkey: ${{ matrix.target }}
clean: ${{ contains(github.event.action, 'nocache') }}
prefix: ${{ github.workspace }}/openwrt
- name: 编译固件
id: compile
working-directory: ./openwrt
run: |
echo -e "$(($(nproc)+1)) thread compile"
make -j$(($(nproc)+1)) || make -j1 V=s
echo "status=success" >> $GITHUB_OUTPUT
- name: 检查空间使用情况
if: (!cancelled())
run: df -hT
- name: 上传bin目录
uses: actions/upload-artifact@main
continue-on-error: true
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true'
with:
name: ${{ env.VERSION }}_${{matrix.target}}
path: |
openwrt/bin/
- name: 打包ipk成zip文件
id: afb
continue-on-error: true
if: steps.compile.outputs.status == 'success' && !cancelled()
run: |
$GITHUB_WORKSPACE/$DIY_SH_AFB
echo "status=success" >> $GITHUB_OUTPUT
- name: 整理文件
id: organize
if: env.UPLOAD_FIRMWARE == 'true' && steps.afb.outputs.status == 'success' && !cancelled()
run: |
mkdir firmware ipks
[ ${{github.event.inputs.UPLOAD_RELEASE}} = true ] && cp -u -f openwrt/kernelipks.zip firmware
[ ${{github.event.inputs.UPLOAD_RELEASE}} = true ] && cp -u -f openwrt/ipks.zip firmware
cp -u -f openwrt/kernelipks.zip ipks
cp -u -f openwrt/ipks.zip ipks
mv -f openwrt/bin/targets/*/*/{*combined*,*ext4*,*sdk*,*imagebuilder*,*buildinfo*,*manifest*,*json*,*sha256sums*} ./firmware/ 2>/dev/null || true
[ $UPLOAD_SYSUPGRADE = true ] && mv -f openwrt/bin/targets/*/*/{*combined*,*sysupgrade*,*openwrt*,*initramfs*,*factory*} ./firmware/ 2>/dev/null || true
cp openwrt/.config ./firmware/${{matrix.target}}.config
cp openwrt/build_dir/target-*/linux-*/linux-*/.config ./firmware/${{matrix.target}}_kernel.config
cd firmware
echo "v${{ env.date2 }}" > version.txt
echo ${{matrix.target}} >> version.txt
rm -rf sha256sums
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "status=success" >> $GITHUB_OUTPUT
- name: 上传firmware目录
uses: actions/upload-artifact@main
continue-on-error: true
if: steps.organize.outputs.status == 'success' && env.UPLOAD_FIRMWARE == 'true'
with:
name: ${{ env.VERSION }}_${{matrix.target}}_firmware_24.10-${{github.event.inputs.MACH}}-${{ github.event.inputs.SETIP }}${{ env.Kernel_Test }}
path: |
firmware
- name: 上传ipk目录
uses: actions/upload-artifact@main
continue-on-error: true
if: steps.organize.outputs.status == 'success' && env.UPLOAD_IPK_DIR == 'true' && steps.afb.outputs.status == 'success'
with:
name: ${{ env.VERSION }}_${{matrix.target}}_ipks_24.10-${{github.event.inputs.MACH}}${{ env.Kernel_Test }}
path: |
ipks
- name: 上传固件cowtransfer
id: cowtransfer
if: steps.organize.outputs.status == 'success' && env.UPLOAD_COWTRANSFER == 'true' && !cancelled()
run: |
curl -fsSL git.io/file-transfer | sh
./transfer cow --block 2621440 -s -p 64 --no-progress ${FIRMWARE} 2>&1 | tee cowtransfer.log
echo "::warning file=cowtransfer.com::$(cat cowtransfer.log | grep https)"
echo "url=$(cat cowtransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT
- name: 上传固件WeTransfer
id: wetransfer
if: steps.organize.outputs.status == 'success' && env.UPLOAD_WETRANSFER == 'true' && !cancelled()
run: |
curl -fsSL git.io/file-transfer | sh
./transfer wet -s -p 16 --no-progress ${FIRMWARE} 2>&1 | tee wetransfer.log
echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep https)"
echo "url=$(cat wetransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT
- name: 生成发布标签
id: tag
if: steps.organize.outputs.status == 'success' && github.event.inputs.UPLOAD_RELEASE == 'true' && !cancelled()
run: |
touch release.txt
$GITHUB_WORKSPACE/gen-sha256sum.sh
echo "# 当前固件IP地址:"${{ github.event.inputs.SETIP }}" " >> release.txt
[ ${{matrix.target}} = mt798x* ] && [ -e openwrt/target/linux/mediatek/filogic/base-files/lib/firmware/mediatek/nx30pro_eeprom.bin ] && echo "- eeprom 使用 H3C NX30 Pro 提取版本" >> release.txt
[ ${{github.event.inputs.MACH}} = rax3000m-emmc ] && echo "- 使用闪存频率: ($(grep -oP "max-frequency = <\K[0-9]*" openwrt/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc-ubootmod.dts)) Hz" >> release.txt
[ $UPLOAD_COWTRANSFER = true ] && echo "🔗 [Cowtransfer](${{ steps.cowtransfer.outputs.url }})" >> release.txt
[ $UPLOAD_WETRANSFER = true ] && echo "🔗 [WeTransfer](${{ steps.wetransfer.outputs.url }})" >> release.txt
echo "status=success" >> $GITHUB_OUTPUT
- name: 上传固件发布
uses: softprops/action-gh-release@v2
if: steps.tag.outputs.status == 'success' && !cancelled()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: "${{ env.FIRMWARE }}/*"
name: ${{ env.date }} ${{matrix.target}}-${{github.event.inputs.MACH}}-openwrt-2410
tag_name: ${{ env.date }}_${{matrix.target}}-${{github.event.inputs.MACH}}-openwrt-2410
body_path: release.txt
- name: 删除工作流
uses: Mattraks/delete-workflow-runs@main
continue-on-error: true
with:
retain_days: 6
keep_minimum_runs: 9
- name: 删除旧版本
uses: dev-drprasad/delete-older-releases@master
if: github.event.inputs.UPLOAD_RELEASE == 'true' && !cancelled()
continue-on-error: true
with:
keep_latest: 24
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}