├── .github └── workflows │ └── build-openwrt.yml ├── LICENSE ├── README.md ├── diy-part1.sh ├── diy-part2.sh └── x86_64_mini.config /.github/workflows/build-openwrt.yml: -------------------------------------------------------------------------------- 1 | #================================================= 2 | # https://github.com/Lancenas/Actions-Lean-OpenWrt 3 | # Description: Build OpenWrt using GitHub Actions 4 | # Lisence: MIT 5 | # Author: P3TERX 6 | # Blog: https://P3TERX.com 7 | #================================================= 8 | 9 | name: OpenWrt Builder 10 | 11 | on: 12 | repository_dispatch: 13 | workflow_dispatch: 14 | 15 | env: 16 | REPO_URL: https://github.com/coolsnowwolf/lede 17 | REPO_BRANCH: master 18 | FEEDS_CONF: feeds.conf.default 19 | CONFIG_FILE: x86_64_mini.config 20 | DIY_P1_SH: diy-part1.sh 21 | DIY_P2_SH: diy-part2.sh 22 | UPLOAD_BIN_DIR: false 23 | UPLOAD_FIRMWARE: true 24 | UPLOAD_RELEASE: true 25 | TZ: Asia/Shanghai 26 | 27 | jobs: 28 | build: 29 | runs-on: ubuntu-22.04 30 | 31 | steps: 32 | - name: Checkout 33 | uses: actions/checkout@main 34 | 35 | - name: Initialization environment 36 | env: 37 | DEBIAN_FRONTEND: noninteractive 38 | run: | 39 | sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL 40 | sudo docker image prune --all --force 41 | sudo -E apt-get -qq update 42 | sudo -E apt-get -qq 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 python2.7 python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev 43 | sudo -E apt-get -qq autoremove --purge 44 | sudo -E apt-get -qq clean 45 | sudo timedatectl set-timezone "$TZ" 46 | sudo mkdir -p /workdir 47 | sudo chown $USER:$GROUPS /workdir 48 | 49 | - name: Clone source code 50 | working-directory: /workdir 51 | run: | 52 | df -hT $PWD 53 | git clone $REPO_URL -b $REPO_BRANCH openwrt 54 | ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt 55 | 56 | - name: Load custom feeds 57 | run: | 58 | [ -e $FEEDS_CONF ] && mv $FEEDS_CONF openwrt/feeds.conf.default 59 | chmod +x $DIY_P1_SH 60 | cd openwrt 61 | $GITHUB_WORKSPACE/$DIY_P1_SH 62 | 63 | - name: Update feeds 64 | run: cd openwrt && ./scripts/feeds update -a 65 | 66 | - name: Install feeds 67 | run: cd openwrt && ./scripts/feeds install -a 68 | 69 | - name: Load custom configuration 70 | run: | 71 | [ -e files ] && mv files openwrt/files 72 | [ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config 73 | chmod +x $DIY_P2_SH 74 | cd openwrt 75 | $GITHUB_WORKSPACE/$DIY_P2_SH 76 | 77 | - name: Download package 78 | id: package 79 | run: | 80 | cd openwrt 81 | make defconfig 82 | make download -j8 83 | find dl -size -1024c -exec ls -l {} \; 84 | find dl -size -1024c -exec rm -f {} \; 85 | 86 | - name: Compile the firmware 87 | id: compile 88 | run: | 89 | cd openwrt 90 | echo -e "$(nproc) thread compile" 91 | make -j$(nproc) || make -j1 || make -j1 V=s 92 | echo "status=success" >> $GITHUB_OUTPUT 93 | grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' > DEVICE_NAME 94 | [ -s DEVICE_NAME ] && echo "DEVICE_NAME=_$(cat DEVICE_NAME)" >> $GITHUB_ENV 95 | echo "FILE_DATE=_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV 96 | 97 | - name: Check space usage 98 | if: (!cancelled()) 99 | run: df -hT 100 | 101 | - name: Upload bin directory 102 | uses: actions/upload-artifact@main 103 | if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true' 104 | with: 105 | name: OpenWrt_bin${{ env.DEVICE_NAME }}${{ env.FILE_DATE }} 106 | path: openwrt/bin 107 | 108 | - name: Organize files 109 | id: organize 110 | if: env.UPLOAD_FIRMWARE == 'true' && !cancelled() 111 | run: | 112 | cd openwrt/bin/targets/*/* 113 | rm -rf packages 114 | echo "FIRMWARE=$PWD" >> $GITHUB_ENV 115 | echo "status=success" >> $GITHUB_OUTPUT 116 | 117 | - name: Upload firmware directory 118 | uses: actions/upload-artifact@main 119 | if: steps.organize.outputs.status == 'success' && !cancelled() 120 | with: 121 | name: OpenWrt_firmware${{ env.DEVICE_NAME }}${{ env.FILE_DATE }} 122 | path: ${{ env.FIRMWARE }} 123 | 124 | - name: Generate release tag 125 | id: tag 126 | if: env.UPLOAD_RELEASE == 'true' && !cancelled() 127 | run: | 128 | echo "release_tag=$(date +"%Y.%m.%d-%H%M")" >> $GITHUB_OUTPUT 129 | touch release.txt 130 | [ ${UPLOAD_GOFILE} = true && ${{ steps.gofile.outputs.url }} ] && echo "🔗 [GoFile](${{ steps.gofile.outputs.url }})" >> release.txt 131 | echo "status=success" >> $GITHUB_OUTPUT 132 | 133 | - name: Upload firmware to release 134 | uses: softprops/action-gh-release@master 135 | if: steps.tag.outputs.status == 'success' && !cancelled() 136 | env: 137 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 138 | with: 139 | tag_name: ${{ steps.tag.outputs.release_tag }} 140 | body_path: release.txt 141 | files: ${{ env.FIRMWARE }}/* 142 | 143 | - name: Delete workflow runs 144 | uses: Mattraks/delete-workflow-runs@main 145 | with: 146 | retain_days: 0 147 | keep_minimum_runs: 2 148 | 149 | - name: Remove old Releases 150 | uses: dev-drprasad/delete-older-releases@master 151 | if: env.UPLOAD_RELEASE == 'true' && !cancelled() 152 | with: 153 | keep_latest: 3 154 | delete_tags: true 155 | env: 156 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 157 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 P3TERX 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Actions-Lean-OpenWrt 2 | 3 | - `master`是[coolsnowwolf/lede](https://github.com/coolsnowwolf/lede)编译. 4 | - 自定义文件 “files 大法”是把你自定义的配置编译到固件里。这样升级或恢复出厂设置都不需要保留配置,缺省值就是自定义的配置。 5 | - 如你现在的network设置编译进固件:首先提取路由固件下的`\etc\config\network` 然后在项目根目录下创建files目录并`push` 到 `\files\etc\config\network `,最后编译出来的固件就是现在设置的network。 6 | - 通过修改`diypart1.sh`文件修改`feeds.conf.default`配置。默认添加`fw876/helloworld` 7 | - 通过修改`diypart2.sh`文件可以自定义默认IP,登陆密码等。按我的需要现在的默认IP为`192.168.1.11`,不需要更改的加`#`注释就可以。 8 | - 自定义编译的方法可以搭配使用,自己需要的服务一般不会随意变化,就可以在 `make menuconfig` 选好(新手参考[OpenWrt MenuConfig设置和LuCI插件选项说明](https://mtom.ml/827.html))后执行 `./scripts/diffconfig.sh > seed.config` 复制一下这个`seed.config`的文本内容到项目根目录的`.config`文件中(建议自命名),这样就不用每次都SSH连接到 Actions生成编译配置,真正一键编译。 9 | - 修改`.github/workflows/build-openwrt.yml`中`.config`为你的自命名###.config文件。 10 | - 另外如果,使用“files 大法”仓库最好设为私有,否则你的配置信息,如宽带账号等会公开在网上。 11 | - 如果需要可以编写多个`workflows`文件对应`###.config`,开启多流程同时编译。 12 | - 在 Actions 页面选择Build OpenWrt,然后点击Run Workflow按钮,即可开始编译。(如果需要 SSH 连接则把SSH connection to Actions的值改为true) 13 | -------------------------------------------------------------------------------- /diy-part1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #============================================================= 3 | # https://github.com/Lancenas/Actions-Lean-OpenWrt 4 | # File name: diy-part1.sh 5 | # Description: OpenWrt DIY script part 1 (Before Update feeds) 6 | # Lisence: MIT 7 | # Author: P3TERX 8 | # Blog: https://p3terx.com 9 | #============================================================= 10 | 11 | # fw876/helloworld 12 | # sed -i 's/^#\(.*helloworld\)/\1/' feeds.conf.default 13 | 14 | # Add a feed source 15 | # echo 'src-git helloworld https://github.com/fw876/helloworld' >>feeds.conf.default 16 | # echo 'src-git passwall https://github.com/xiaorouji/openwrt-passwall' >>feeds.conf.default 17 | # echo 'src-git small https://github.com/kenzok8/small' >>feeds.conf.default 18 | 19 | # Lienol/openwrt-package 20 | # sed -i '$a src-git lienol https://github.com/Lancenas/lienol-openwrt-package.git' feeds.conf.default 21 | # sed -i '$a src-git xiaorouji https://github.com/xiaorouji/openwrt-passwall-packages.git' feeds.conf.default 22 | -------------------------------------------------------------------------------- /diy-part2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #============================================================ 3 | # https://github.com/Lancenas/Actions-Lean-OpenWrt 4 | # File name: diy-part2.sh 5 | # Description: OpenWrt DIY script part 2 (After Update feeds) 6 | # Lisence: MIT 7 | # Author: P3TERX 8 | # Blog: https://p3terx.com 9 | #============================================================ 10 | 11 | # Modify default IP 12 | sed -i 's/192.168.1.1/192.168.1.11/g' package/base-files/files/bin/config_generate 13 | -------------------------------------------------------------------------------- /x86_64_mini.config: -------------------------------------------------------------------------------- 1 | # Target Config 2 | CONFIG_TARGET_x86=y 3 | CONFIG_TARGET_x86_64=y 4 | CONFIG_TARGET_x86_64_DEVICE_generic=y 5 | 6 | # Set Firmware Size 7 | CONFIG_TARGET_KERNEL_PARTSIZE=16 8 | CONFIG_TARGET_ROOTFS_PARTSIZE=400 9 | 10 | # Firmware Type 11 | # CONFIG_GRUB_CONSOLE is not set 12 | CONFIG_GRUB_IMAGES=y 13 | CONFIG_GRUB_EFI_IMAGES=y 14 | CONFIG_TARGET_IMAGES_GZIP=y 15 | # CONFIG_TARGET_ROOTFS_EXT4FS is not set 16 | CONFIG_TARGET_ROOTFS_SQUASHFS=y 17 | CONFIG_TARGET_ROOTFS_TARGZ=y 18 | # CONFIG_VMDK_IMAGES is not set 19 | 20 | # Applications 21 | # CONFIG_PACKAGE_luci-app-accesscontrol is not set 22 | # CONFIG_PACKAGE_luci-app-adbyby-plus is not set 23 | CONFIG_PACKAGE_luci-app-adguardhome=y 24 | CONFIG_PACKAGE_luci-app-alist=y 25 | CONFIG_PACKAGE_luci-app-argon-config=y 26 | CONFIG_PACKAGE_luci-app-arpbind=y 27 | CONFIG_PACKAGE_luci-app-autoreboot=y 28 | # CONFIG_PACKAGE_luci-app-cifs-mount is not set 29 | CONFIG_PACKAGE_luci-app-ddns=y 30 | CONFIG_PACKAGE_luci-app-diskman=y 31 | # CONFIG_PACKAGE_luci-app-dockerman is not set 32 | CONFIG_PACKAGE_luci-app-filetransfer=y 33 | CONFIG_PACKAGE_luci-app-firewall=y 34 | # CONFIG_PACKAGE_luci-app-frpc is not set 35 | # CONFIG_PACKAGE_luci-app-ipsec-vpnd is not set 36 | CONFIG_PACKAGE_luci-app-mosdns=y 37 | CONFIG_PACKAGE_luci-app-netdata=y 38 | CONFIG_PACKAGE_luci-app-nlbwmon=y 39 | CONFIG_PACKAGE_luci-app-onliner=y 40 | CONFIG_PACKAGE_luci-app-openclash=y 41 | CONFIG_PACKAGE_luci-app-passwall=y 42 | CONFIG_PACKAGE_luci-app-passwall_Iptables_Transparent_Proxy=y 43 | CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Brook=y 44 | CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Hysteria=y 45 | CONFIG_PACKAGE_luci-app-passwall_INCLUDE_NaiveProxy=y 46 | CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Rust_Client=y 47 | CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Rust_Server=y 48 | CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Server=y 49 | CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Trojan_GO=y 50 | CONFIG_PACKAGE_luci-app-passwall_INCLUDE_tuic_client=y 51 | # CONFIG_PACKAGE_luci-app-passwall2 is not set 52 | # CONFIG_PACKAGE_luci-app-ramfree is not set 53 | # CONFIG_PACKAGE_luci-app-rclone_INCLUDE_rclone-ng is not set 54 | # CONFIG_PACKAGE_luci-app-rclone_INCLUDE_rclone-webui is not set 55 | # CONFIG_PACKAGE_luci-app-samba is not set 56 | CONFIG_PACKAGE_luci-app-samba4=y 57 | # CONFIG_PACKAGE_luci-app-smartdns is not set 58 | CONFIG_PACKAGE_luci-app-ssr-plus=y 59 | CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Hysteria=y 60 | CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_IPT2Socks=y 61 | CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Kcptun=y 62 | CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_NaiveProxy=y 63 | CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Redsocks2=y 64 | CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadow_TLS=y 65 | # CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Libev_Server is not set 66 | CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Rust_Server=y 67 | CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Trojan=y 68 | CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Tuic_Client=y 69 | CONFIG_PACKAGE_luci-app-ttyd=y 70 | CONFIG_PACKAGE_luci-app-turboacc=y 71 | CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_OFFLOADING=y 72 | # CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_DNSFORWARDER is not set 73 | # CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_DNSPROXY is not set 74 | CONFIG_PACKAGE_luci-app-unblockmusic=y 75 | CONFIG_PACKAGE_luci-app-upnp=y 76 | # CONFIG_PACKAGE_luci-app-vlmcsd is not set 77 | # CONFIG_PACKAGE_luci-app-vsftpd is not set 78 | # CONFIG_PACKAGE_luci-app-vssr is not set 79 | # CONFIG_PACKAGE_luci-app-vssr_INCLUDE_Kcptun is not set 80 | # CONFIG_PACKAGE_luci-app-wireguard is not set 81 | # CONFIG_PACKAGE_luci-app-wol is not set 82 | # CONFIG_PACKAGE_luci-app-wrtbwmon is not set 83 | # CONFIG_PACKAGE_luci-app-xlnetacc is not set 84 | CONFIG_PACKAGE_luci-app-zerotier=y 85 | 86 | # Themes 87 | CONFIG_PACKAGE_luci-theme-argon=y 88 | CONFIG_PACKAGE_luci-theme-design=y 89 | CONFIG_PACKAGE_luci-theme-infinityfreedom=y 90 | CONFIG_PACKAGE_luci-theme-opentomcat=y 91 | 92 | # Software 93 | CONFIG_PACKAGE_autosamba=y 94 | CONFIG_PACKAGE_ddns-scripts_cloudflare.com-v4=y 95 | CONFIG_PACKAGE_htop=y 96 | CONFIG_PACKAGE_iperf3=y 97 | CONFIG_PACKAGE_nano-plus=y 98 | CONFIG_PACKAGE_openssh-sftp-server=y 99 | CONFIG_PACKAGE_snmpd=y 100 | CONFIG_PACKAGE_vim-fuller=y 101 | CONFIG_PACKAGE_zsh=y 102 | 103 | # Shortcut-Fe 104 | CONFIG_PACKAGE_kmod-shortcut-fe=y 105 | CONFIG_PACKAGE_kmod-shortcut-fe-cm=y 106 | 107 | # Ipv6 Support 108 | CONFIG_PACKAGE_6in4=y 109 | CONFIG_PACKAGE_ipv6helper=y 110 | CONFIG_PACKAGE_ip6tables=y 111 | CONFIG_PACKAGE_ip6tables-extra=y 112 | CONFIG_PACKAGE_ip6tables-mod-nat=y 113 | --------------------------------------------------------------------------------