OpenWrt-CI #644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This is free software, lisence use MIT. | |
# | |
# Copyright (C) 2019 P3TERX <https://p3terx.com> | |
# Copyright (C) 2019 KFERMercer <[email protected]> | |
# | |
# <https://github.com/KFERMercer/OpenWrt-CI> | |
# | |
name: OpenWrt-CI | |
on: | |
schedule: | |
- cron: 0 21 * * * #北京时间早上5点自动编译,UTC时间 | |
workflow_dispatch: # 允许手动触发 | |
permissions: | |
contents: read | |
jobs: | |
build_openwrt: | |
permissions: | |
contents: write # for release creation | |
name: Build OpenWrt Firmware | |
runs-on: ubuntu-latest | |
steps: | |
- name: Space cleanup and Initialization environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
docker rmi `docker images -q` | |
echo "Deleting files, please wait ..." | |
sudo rm -rf \ | |
/usr/share/dotnet \ | |
/etc/mysql \ | |
/etc/php | |
sudo -E apt update | |
sudo -E apt -y purge azure-cli* docker* ghc* zulu* llvm* firefox google* dotnet* powershell* openjdk* mysql* php* mongodb* dotnet* moby* snap* | |
sudo -E apt -y full-upgrade | |
sudo -E apt -y install ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev libssl-dev libtool lrzsz mkisofs msmtp ninja-build p7zip p7zip-full patch pkgconf python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev | |
sudo -E apt -y autoremove --purge | |
sudo -E apt clean | |
sudo -E timedatectl set-timezone "Asia/Shanghai" | |
- name: Clone My Project | |
uses: actions/checkout@v3 | |
- name: Clone LEDE Code | |
run: | | |
git clone --branch "master" --single-branch https://github.com/coolsnowwolf/lede.git | |
- name: Update feeds | |
run: | | |
cd ./lede | |
./scripts/feeds update -a | |
./scripts/feeds install -a | |
- name: Custom Settings Before Build | |
run: | | |
cd ./lede | |
echo "wan ip set to 192.168.2.1" | |
sed -i 's/192.168.1.1/192.168.2.1/g' package/base-files/files/bin/config_generate | |
#echo "default theme set to design" | |
#sed -i 's/luci-theme-bootstrap/luci-theme-design/' feeds/luci/collections/luci/Makefile | |
#echo "add design and design config repo" | |
#git clone --branch "main" --single-branch https://github.com/gngpp/luci-theme-design.git package/luci-theme-design | |
#git clone --branch "master" --single-branch https://github.com/gngpp/luci-app-design-config.git package/luci-app-design-config | |
echo "add openclash repo" | |
git clone --branch "dev" --single-branch https://github.com/vernesong/OpenClash.git package/openclash | |
echo "openclash base settings" | |
cd ./package/openclash/luci-app-openclash/root/etc/openclash | |
echo "add base openclash ip data" | |
curl -sfL -o ./Country.mmdb https://github.com/alecthw/mmdb_china_ip_list/raw/release/lite/Country.mmdb | |
curl -sfL -o ./GeoSite.dat https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/geosite.dat | |
curl -sfL -o ./GeoIP.dat https://github.com/Loyalsoldier/v2ray-rules-dat/raw/release/geoip.dat | |
echo "add latest dev openclash version" | |
mkdir ./core && cd ./core | |
export TUN_VER=$(curl -sfL https://raw.githubusercontent.com/vernesong/OpenClash/core/dev/core_version | sed -n "2{s/\r$//;p;q}") | |
echo $TUN_VER | |
curl -sfL -o ./tun.gz https://github.com/vernesong/OpenClash/raw/core/dev/premium/clash-linux-arm64-$TUN_VER.gz | |
gzip -d ./tun.gz && mv ./tun ./clash_tun | |
curl -sfL -o ./meta.tar.gz https://github.com/vernesong/OpenClash/raw/core/dev/meta/clash-linux-arm64.tar.gz | |
tar -zxf ./meta.tar.gz && mv ./clash ./clash_meta | |
curl -sfL -o ./dev.tar.gz https://github.com/vernesong/OpenClash/raw/core/dev/dev/clash-linux-arm64.tar.gz | |
tar -zxf ./dev.tar.gz | |
chmod +x ./clash* | |
rm -rf ./*.gz | |
echo 'show openclash info' | |
ls -lh | |
- name: Custom configure file And Generate configuration file | |
run: | | |
cd ./lede | |
rm -f ./.config* | |
touch ./.config | |
# | |
# ========================固件定制部分======================== | |
# | |
# | |
# 如果不对本区块做出任何编辑, 则生成默认配置固件. | |
# | |
# 以下为定制化固件选项和说明: | |
# | |
# | |
# 有些插件/选项是默认开启的, 如果想要关闭, 请参照以下示例进行编写: | |
# | |
# ========================================= | |
# | # 取消编译VMware镜像: | | |
# | cat >> .config <<EOF | | |
# | # CONFIG_VMDK_IMAGES is not set | | |
# | EOF | | |
# ========================================= | |
# | |
# | |
# 以下是一些提前准备好的一些插件选项. | |
# 直接取消注释相应代码块即可应用. 不要取消注释代码块上的汉字说明. | |
# 如果不需要代码块里的某一项配置, 只需要删除相应行. | |
# | |
# 如果需要其他插件, 请按照示例自行添加. | |
# 注意, 只需添加依赖链顶端的包. 如果你需要插件 A, 同时 A 依赖 B, 即只需要添加 A. | |
# | |
# 无论你想要对固件进行怎样的定制, 都需要且只需要修改 EOF 回环内的内容. | |
# | |
# 编译x64固件: | |
# cat >> .config <<EOF | |
# CONFIG_TARGET_x86=y | |
# CONFIG_TARGET_x86_64=y | |
# CONFIG_TARGET_x86_64_Generic=y | |
# EOF | |
# 固件压缩: | |
# cat >> .config <<EOF | |
# CONFIG_TARGET_IMAGES_GZIP=y | |
# EOF | |
# 编译UEFI固件: | |
# cat >> .config <<EOF | |
# CONFIG_EFI_IMAGES=y | |
# EOF | |
# IPv6支持: | |
# cat >> .config <<EOF | |
# CONFIG_PACKAGE_dnsmasq_full_dhcpv6=y | |
# CONFIG_PACKAGE_ipv6helper=y | |
# EOF | |
# 多文件系统支持: | |
# cat >> .config <<EOF | |
# CONFIG_PACKAGE_kmod-fs-nfs=y | |
# CONFIG_PACKAGE_kmod-fs-nfs-common=y | |
# CONFIG_PACKAGE_kmod-fs-nfs-v3=y | |
# CONFIG_PACKAGE_kmod-fs-nfs-v4=y | |
# CONFIG_PACKAGE_kmod-fs-ntfs=y | |
# CONFIG_PACKAGE_kmod-fs-squashfs=y | |
# EOF | |
# USB3.0支持: | |
# cat >> .config <<EOF | |
# CONFIG_PACKAGE_kmod-usb-ohci=y | |
# CONFIG_PACKAGE_kmod-usb-ohci-pci=y | |
# CONFIG_PACKAGE_kmod-usb2=y | |
# CONFIG_PACKAGE_kmod-usb2-pci=y | |
# CONFIG_PACKAGE_kmod-usb3=y | |
# EOF | |
# 常用LuCI插件选择: | |
# cat >> .config <<EOF | |
# CONFIG_PACKAGE_luci-app-adbyby-plus=y | |
# CONFIG_PACKAGE_luci-app-aria2=y | |
# CONFIG_PACKAGE_luci-app-baidupcs-web=y | |
# CONFIG_PACKAGE_luci-app-docker=y | |
# CONFIG_PACKAGE_luci-app-frpc=y | |
# CONFIG_PACKAGE_luci-app-hd-idle=y | |
# CONFIG_PACKAGE_luci-app-kodexplorer=y | |
# CONFIG_PACKAGE_luci-app-minidlna=y | |
# CONFIG_PACKAGE_luci-app-openvpn=y | |
# CONFIG_PACKAGE_luci-app-openvpn-server=y | |
# CONFIG_PACKAGE_luci-app-qbittorrent=y | |
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Kcptun=y | |
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks=y | |
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_ShadowsocksR_Server=y | |
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_ShadowsocksR_Socks=y | |
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_V2ray=y | |
# CONFIG_PACKAGE_luci-app-ttyd=y | |
# CONFIG_PACKAGE_luci-app-v2ray-server=y | |
# CONFIG_PACKAGE_luci-app-verysync=y | |
# CONFIG_PACKAGE_luci-app-webadmin=y | |
# CONFIG_PACKAGE_luci-app-wireguard=y | |
# CONFIG_PACKAGE_luci-app-wrtbwmon=y | |
# EOF | |
# LuCI主题: | |
# cat >> .config <<EOF | |
# CONFIG_PACKAGE_luci-theme-argon=y | |
# CONFIG_PACKAGE_luci-theme-netgear=y | |
# EOF | |
# 常用软件包: | |
# cat >> .config <<EOF | |
# CONFIG_PACKAGE_curl=y | |
# CONFIG_PACKAGE_htop=y | |
# CONFIG_PACKAGE_nano=y | |
# CONFIG_PACKAGE_screen=y | |
# CONFIG_PACKAGE_tree=y | |
# CONFIG_PACKAGE_vim-fuller=y | |
# CONFIG_PACKAGE_wget=y | |
# EOF | |
# 取消编译VMware镜像以及镜像填充 (不要删除被缩进的注释符号): | |
# cat >> .config <<EOF | |
# # CONFIG_TARGET_IMAGES_PAD is not set | |
# # CONFIG_VMDK_IMAGES is not set | |
# EOF | |
# 以下开始是个性化定制内容 | |
# 编译r4s固件: | |
cat >> .config <<EOF | |
CONFIG_TARGET_rockchip=y | |
CONFIG_TARGET_rockchip_armv8=y | |
CONFIG_TARGET_rockchip_armv8_DEVICE_friendlyarm_nanopi-r4s=y | |
EOF | |
# 部分配置修改: | |
cat >> .config <<EOF | |
CONFIG_TARGET_ROOTFS_TARGZ=y | |
CONFIG_TARGET_ROOTFS_SQUASHFS=y | |
CONFIG_TARGET_IMAGES_GZIP=y | |
CONFIG_TARGET_ROOTFS_EXT4FS=y | |
CONFIG_TARGET_ROOTFS_PARTSIZE=1024 | |
EOF | |
# 常用LuCI插件和额外包选择: | |
cat >> .config <<EOF | |
CONFIG_PACKAGE_ipv6helper=y | |
CONFIG_PACKAGE_dnsmasq_full_dhcpv6=y | |
CONFIG_PACKAGE_ip6tables-extra=y | |
CONFIG_PACKAGE_ip6tables-mod-nat=y | |
CONFIG_PACKAGE_autosamba=y | |
CONFIG_PACKAGE_luci-app-diskman=y | |
CONFIG_PACKAGE_luci-app-openclash=y | |
CONFIG_PACKAGE_luci-app-uugamebooster=y | |
CONFIG_PACKAGE_luci-app-wrtbwmon=y | |
CONFIG_PACKAGE_luci-app-ttyd=y | |
CONFIG_PACKAGE_luci-app-ddns=y | |
EOF | |
# LuCI主题: | |
#cat >> .config <<EOF | |
#CONFIG_PACKAGE_luci-theme-design=y | |
#CONFIG_PACKAGE_luci-app-design-config=y | |
#EOF | |
# 取消编译(不要删除被缩进的注释符号): | |
# 依据:CONFIG_DEFAULT_luci-app-xxx | |
cat >> .config <<EOF | |
# CONFIG_PACKAGE_luci-app-accesscontrol is not set | |
# CONFIG_PACKAGE_luci-app-ssr-plus is not set | |
# CONFIG_PACKAGE_luci-app-vlmcsd is not set | |
# CONFIG_PACKAGE_luci-app-wol is not set | |
# CONFIG_PACKAGE_luci-app-xlnetacc is not set | |
# CONFIG_PACKAGE_luci-app-zerotier is not set | |
# CONFIG_PACKAGE_luci-app-wireguard is not set | |
# CONFIG_PACKAGE_luci-app-ipsec-vpnd is not set | |
# CONFIG_PACKAGE_luci-app-adbyby-plus is not set | |
EOF | |
# | |
# ========================固件定制部分结束======================== | |
# | |
sed -i 's/^[ \t]*//g' ./.config | |
make defconfig | |
- name: Make download | |
run: | | |
cd ./lede | |
make download -j16 | |
- name: Compile firmware | |
run: | | |
cd ./lede | |
make -j$(nproc) || make -j1 V=s | |
echo "=======================" | |
echo "Space usage:" | |
echo "=======================" | |
df -h | |
echo "=======================" | |
du -h --max-depth=1 ./ --exclude=build_dir --exclude=bin | |
du -h --max-depth=1 ./build_dir | |
du -h --max-depth=1 ./bin | |
export BuildDate="`date +%Y%m%d`" | |
echo "BuildDate=$BuildDate" >> $GITHUB_ENV | |
- name: Assemble artifact | |
run: | | |
cd ./lede | |
rm -rf ./artifact/ | |
mkdir -p ./artifact/ | |
find ./bin/targets/ -name "*sysupgrade*img*" | xargs -i mv -f {} ./artifact/ | |
cp ./.config ./artifact/r4s_config.txt | |
- name: Upload to Qinu | |
run: | | |
cd ./qiniu | |
chmod +x qshell | |
./qshell account ${{secrets.QAK}} ${{secrets.QSK}} qiniu --overwrite | |
./qshell fput staticdownload openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-squashfs-sysupgrade.img.gz ../lede/artifact/openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-squashfs-sysupgrade.img.gz --overwrite | |
./qshell fput staticdownload openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-ext4-sysupgrade.img.gz ../lede/artifact/openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-ext4-sysupgrade.img.gz --overwrite | |
./qshell fput staticdownload r4s.config ../lede/artifact/r4s_config.txt --overwrite | |
- name: Upload artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: R4S_build_${{env.BuildDate}} | |
path: ./lede/artifact/ | |
- name: Release Firmware | |
uses: softprops/action-gh-release@master | |
with: | |
tag_name: R4S_build_${{env.BuildDate}} | |
files: ./lede/artifact/*.* | |
body: | | |
固件介绍页面:[https://www.qyh.name/807/](https://www.qyh.name/807/) | |
默认管理地址:192.168.2.1 | |
默认账号:root | |
默认密码:password | |
默认主题:design | |
当前内核分区:32MB | |
当前系统分区:1024MB | |
分流下载 | |
请注意,分流地址下载的只能是最新版本,无法下载到历史版本 | |
[ext4版本固件](https://down.cdn.qyh0214.com/openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-ext4-sysupgrade.img.gz) | |
[squashfs版本固件](https://down.cdn.qyh0214.com/openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-squashfs-sysupgrade.img.gz) | |
[配置文件](https://down.cdn.qyh0214.com/r4s.config) | |
Gitlab镜像编译版本 | |
请注意,分流地址下载的只能是最新版本,无法下载到历史版本,有关于历史版本请访问[Gitlab](http://git.qyh.name/shihuang/routerbuild/-/releases) | |
[ext4版本固件](https://down.cdn.qyh0214.com/openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-ext4-sysupgrade-gitlab.img.gz) | |
[squashfs版本固件](https://down.cdn.qyh0214.com/openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-squashfs-sysupgrade-gitlab.img.gz) | |
[配置文件](https://down.cdn.qyh0214.com/r4s-gitlab.config) |