├── README.zh.md ├── openwrt-bandix ├── files │ ├── bandix.config │ └── bandix.init └── Makefile ├── README.md ├── LICENSE └── .github └── workflows └── Auto compile with openwrt sdk.yml /README.zh.md: -------------------------------------------------------------------------------- 1 | # openwrt-bandix 2 | 3 | [English](README.md) 简体中文 4 | 5 | [![许可证](https://img.shields.io/badge/许可证-Apache--2.0-blue.svg)](LICENSE) 6 | 7 | ## 简介 8 | 9 | openwrt-bandix 是 luci-app-bandix 的依赖包,提供网络流量监控的核心功能。 10 | 11 | ## 安装方法 12 | 13 | ### 从 Release 下载安装 14 | 15 | 1. 前往 [Release 页面](https://github.com/timsaya/openwrt-bandix/releases) 下载适合您设备架构的 ipk 文件 16 | 17 | 2. 将下载的 ipk 文件上传到您的 OpenWrt 设备 18 | 19 | 3. 安装: 20 | 21 | ```bash 22 | opkg install /path/to/bandix_xxx.ipk 23 | ``` 24 | 25 | ## 许可证 26 | 27 | 本项目采用 Apache-2.0 许可证。 28 | 29 | ## 维护者 30 | 31 | - [timsaya](https://github.com/timsaya) -------------------------------------------------------------------------------- /openwrt-bandix/files/bandix.config: -------------------------------------------------------------------------------- 1 | 2 | config bandix 'general' 3 | option iface 'br-lan' 4 | option port '8686' 5 | option data_dir '/usr/share/bandix' 6 | 7 | option language 'auto' 8 | option theme 'auto' 9 | 10 | option log_level 'info' 11 | 12 | 13 | config bandix 'traffic' 14 | option enabled '0' 15 | option speed_unit 'bytes' 16 | option offline_timeout '600' 17 | option traffic_retention_seconds '600' 18 | option traffic_flush_interval_seconds '600' 19 | option traffic_persist_history '0' 20 | 21 | 22 | config bandix 'connections' 23 | option enabled '0' 24 | 25 | 26 | config bandix 'dns' 27 | option enabled '0' 28 | option dns_max_records '10000' 29 | 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # openwrt-bandix 2 | 3 | English | [简体中文](README.zh.md) 4 | 5 | 6 | [![License](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](LICENSE) 7 | 8 | ## Introduction 9 | 10 | openwrt-bandix is a dependency package for luci-app-bandix, providing core functionality for network traffic monitoring. 11 | 12 | ## Installation 13 | 14 | ### Install from Release 15 | 16 | 1. Visit the [Release page](https://github.com/timsaya/openwrt-bandix/releases) to download the ipk file suitable for your device architecture 17 | 18 | 2. Upload the downloaded ipk file to your OpenWrt device 19 | 20 | 3. Install: 21 | 22 | ```bash 23 | opkg install /path/to/bandix_xxx.ipk 24 | ``` 25 | 26 | ## License 27 | 28 | This project is licensed under the Apache-2.0 License. 29 | 30 | ## Maintainer 31 | 32 | - [timsaya](https://github.com/timsaya) -------------------------------------------------------------------------------- /openwrt-bandix/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=bandix 4 | PKG_VERSION:=0.11.0 5 | PKG_RELEASE:=1 6 | 7 | PKG_LICENSE:=Apache-2.0 8 | PKG_MAINTAINER:=timsaya 9 | 10 | include $(INCLUDE_DIR)/package.mk 11 | 12 | # 使用OpenWrt的Rust映射机制 13 | include $(TOPDIR)/feeds/packages/lang/rust/rust-values.mk 14 | 15 | # 二进制文件的文件名和URL 16 | RUST_BANDIX_VERSION:=0.11.0 17 | RUST_BINARY_FILENAME:=bandix-$(RUST_BANDIX_VERSION)-$(RUSTC_TARGET_ARCH).tar.gz 18 | 19 | 20 | # 修正下载地址定义方式 21 | PKG_SOURCE:=$(RUST_BINARY_FILENAME) 22 | PKG_SOURCE_URL:=https://github.com/timsaya/bandix/releases/download/v$(RUST_BANDIX_VERSION) 23 | PKG_HASH:=skip 24 | 25 | define Package/$(PKG_NAME) 26 | SECTION:=net 27 | CATEGORY:=Network 28 | TITLE:=Bandix - Network traffic monitoring tool 29 | endef 30 | 31 | define Package/$(PKG_NAME)/description 32 | Bandix core service for network traffic monitoring 33 | endef 34 | 35 | define Build/Prepare 36 | mkdir -p $(PKG_BUILD_DIR)/bin 37 | gzip -dc "$(DL_DIR)/$(PKG_SOURCE)" | tar -C $(PKG_BUILD_DIR)/bin --strip-components=1 -xf - 38 | $(Build/Patch) 39 | endef 40 | 41 | define Build/Compile 42 | # nothing to do 43 | endef 44 | 45 | define Package/$(PKG_NAME)/install 46 | $(INSTALL_DIR) $(1)/usr/bin 47 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/bandix $(1)/usr/bin/ 48 | 49 | # 添加启动脚本和配置文件 50 | $(INSTALL_DIR) $(1)/etc/init.d 51 | $(INSTALL_DIR) $(1)/etc/config 52 | $(INSTALL_BIN) ./files/bandix.init $(1)/etc/init.d/bandix 53 | 54 | # 将配置文件安装到临时位置,由 postinst 决定是否复制到最终位置 55 | $(INSTALL_DIR) $(1)/usr/share/bandix 56 | $(INSTALL_CONF) ./files/bandix.config $(1)/etc/config/bandix 57 | endef 58 | 59 | 60 | define Package/$(PKG_NAME)/postinst 61 | #!/bin/sh 62 | if [ -z "$${IPKG_INSTROOT}" ]; then 63 | 64 | # 添加到 sysupgrade.conf 以在系统升级时保留 65 | if ! grep -q "^/usr/share/bandix$$" /etc/sysupgrade.conf; then 66 | echo "/usr/share/bandix" >> /etc/sysupgrade.conf 67 | fi 68 | if ! grep -q "^/etc/config/bandix$$" /etc/sysupgrade.conf; then 69 | echo "/etc/config/bandix" >> /etc/sysupgrade.conf 70 | fi 71 | fi 72 | endef 73 | 74 | $(eval $(call BuildPackage,bandix)) -------------------------------------------------------------------------------- /openwrt-bandix/files/bandix.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | START=99 4 | USE_PROCD=1 5 | PROG=/usr/bin/bandix 6 | 7 | service_triggers() { 8 | procd_add_reload_trigger "bandix" 9 | } 10 | 11 | reload_service() { 12 | restart 13 | } 14 | 15 | start_service() { 16 | local iface 17 | local port 18 | local data_dir 19 | local log_level 20 | local traffic_enabled 21 | local traffic_retention_seconds 22 | local traffic_flush_interval_seconds 23 | local traffic_persist_history 24 | local connections_enabled 25 | local dns_enabled 26 | local dns_max_records 27 | 28 | # 这个逻辑在每次服务启动时执行,确保备份配置始终正确 29 | if [ -f /etc/sysupgrade.conf ]; then 30 | # 添加数据目录到备份列表 31 | if ! grep -q "^/usr/share/bandix$" /etc/sysupgrade.conf; then 32 | echo "/usr/share/bandix" >> /etc/sysupgrade.conf 33 | fi 34 | # 添加配置文件到备份列表 35 | if ! grep -q "^/etc/config/bandix$" /etc/sysupgrade.conf; then 36 | echo "/etc/config/bandix" >> /etc/sysupgrade.conf 37 | fi 38 | fi 39 | 40 | config_load 'bandix' 41 | config_get iface 'general' 'iface' 42 | config_get port 'general' 'port' 43 | config_get data_dir 'general' 'data_dir' 44 | config_get log_level 'general' 'log_level' 45 | config_get_bool traffic_enabled 'traffic' 'enabled' 46 | config_get traffic_retention_seconds 'traffic' 'traffic_retention_seconds' 47 | config_get traffic_flush_interval_seconds 'traffic' 'traffic_flush_interval_seconds' 48 | config_get_bool traffic_persist_history 'traffic' 'traffic_persist_history' 49 | config_get_bool connections_enabled 'connections' 'enabled' 50 | config_get_bool dns_enabled 'dns' 'enabled' 51 | config_get dns_max_records 'dns' 'dns_max_records' 52 | 53 | [ "$connections_enabled" != 1 ] && [ "$traffic_enabled" != 1 ] && [ "$dns_enabled" != 1 ] && return 1 54 | 55 | # 构建基础命令行参数 56 | local args="--iface $iface --port $port --data-dir $data_dir" 57 | if [ -n "$log_level" ]; then 58 | args="$args --log-level $log_level" 59 | fi 60 | 61 | # 添加流量监控相关参数 62 | if [ "$traffic_enabled" -eq 1 ]; then 63 | args="$args --enable-traffic" 64 | fi 65 | if [ -n "$traffic_retention_seconds" ]; then 66 | args="$args --traffic-retention-seconds $traffic_retention_seconds" 67 | fi 68 | if [ -n "$traffic_flush_interval_seconds" ]; then 69 | args="$args --traffic-flush-interval-seconds $traffic_flush_interval_seconds" 70 | fi 71 | if [ "$traffic_persist_history" -eq 1 ]; then 72 | args="$args --traffic-persist-history" 73 | fi 74 | 75 | # 添加连接统计监控参数 76 | if [ "$connections_enabled" -eq 1 ]; then 77 | args="$args --enable-connection" 78 | fi 79 | 80 | # 添加 DNS 监控参数 81 | if [ "$dns_enabled" -eq 1 ]; then 82 | args="$args --enable-dns" 83 | fi 84 | if [ -n "$dns_max_records" ]; then 85 | args="$args --dns-max-records $dns_max_records" 86 | fi 87 | 88 | procd_open_instance bandix 89 | procd_set_param command $PROG $args 90 | procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-10} ${respawn_retry:-10} 91 | procd_set_param stderr 1 92 | procd_set_param stdout 1 93 | procd_set_param pidfile /var/run/bandix.pid 94 | procd_close_instance 95 | } 96 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} Authors of bpfman. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /.github/workflows/Auto compile with openwrt sdk.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2022-2025 SMALLPROGRAM 3 | # Description: Auto compile 4 | # 5 | name: "Auto compile with openwrt sdk" 6 | on: 7 | repository_dispatch: 8 | workflow_dispatch: 9 | inputs: 10 | ssh: 11 | description: 'SSH connection to Actions' 12 | required: false 13 | default: 'false' 14 | env: 15 | TZ: Asia/Shanghai 16 | openwrt-bandix: ${{ github.repository }} 17 | 18 | jobs: 19 | job_check: 20 | name: Check Version 21 | runs-on: ubuntu-latest 22 | outputs: 23 | openwrt-bandix_version: ${{ steps.check_version.outputs.latest_version }} 24 | has_update: ${{ steps.check_version.outputs.has_update }} 25 | steps: 26 | - name: Checkout 27 | uses: actions/checkout@main 28 | with: 29 | fetch-depth: 0 30 | ref: ${{ github.ref_name }} 31 | 32 | - name: Check version 33 | id: check_version 34 | env: 35 | url_tags: https://api.github.com/repos/${{ env.openwrt-bandix }}/releases/latest 36 | run: | 37 | cd openwrt-bandix 38 | # 提取版本号和发布号 39 | pkg_version=$(awk -F ':=' '/^PKG_VERSION:=/ {print $2}' Makefile | tr -d ' ') 40 | pkg_release=$(awk -F ':=' '/^PKG_RELEASE:=/ {print $2}' Makefile | tr -d ' ') 41 | 42 | # 检查版本号是否提取成功 43 | if [ -z "$pkg_version" ] || [ -z "$pkg_release" ]; then 44 | echo "Error: Failed to extract version from Makefile" 45 | echo "PKG_VERSION: '$pkg_version'" 46 | echo "PKG_RELEASE: '$pkg_release'" 47 | exit 1 48 | fi 49 | 50 | # 格式化为 v0.8.1-r2 格式,如果是 r1 则省略 51 | if [ "$pkg_release" = "1" ]; then 52 | latest_version="v${pkg_version}" 53 | else 54 | latest_version="v${pkg_version}-r${pkg_release}" 55 | fi 56 | echo "latest_version=${latest_version}" >> $GITHUB_OUTPUT 57 | 58 | remote_latest_version=$(wget -qO- -t1 -T2 ${{env.url_tags}} | jq -r '.tag_name') 59 | 60 | if [ -z "$remote_latest_version" ] || [ "$remote_latest_version" = "null" ]; then 61 | echo "Failed to fetch remote tags" 62 | echo "has_update=true" >> $GITHUB_OUTPUT 63 | exit 0 64 | fi 65 | echo "Remote latest: $remote_latest_version" 66 | 67 | # 去掉 tag_name 中的 v 前缀和 r 前缀,-r1 可以省略 68 | # 格式:v0.8.1-r2 -> 0.8.1-2, v0.8.1-r1 -> 0.8.1, v0.8.1 -> 0.8.1 69 | normalized_local_version=$(echo "$latest_version" | sed 's/^v//' | sed 's/-r\([0-9]*\)$/-\1/' | sed 's/-1$//') 70 | normalized_remote_version=$(echo "$remote_latest_version" | sed 's/^v//' | sed 's/-r\([0-9]*\)$/-\1/' | sed 's/-1$//') 71 | 72 | if [ "$normalized_local_version" = "$normalized_remote_version" ]; then 73 | echo "has_update=false" >> $GITHUB_OUTPUT 74 | else 75 | echo "has_update=true" >> $GITHUB_OUTPUT 76 | fi 77 | 78 | 79 | - name: Prepare release 80 | if: steps.check_version.outputs.has_update == 'true' 81 | run: | 82 | echo "![](https://img.shields.io/github/downloads/${{ env.openwrt-bandix }}/${{steps.check_version.outputs.latest_version}}/total?style=flat-square) ![](https://github.com/${{ env.openwrt-bandix }}/actions/workflows/Auto%20compile%20with%20openwrt%20sdk.yml/badge.svg)" > release.txt 83 | echo "" >> release.txt 84 | echo "> ⚠️ **Note**: Packages for other platforms are currently being built. Files will be added to this release as they complete." >> release.txt 85 | echo "> ⚠️ **注意**: 其他平台的软件包正在构建中,完成后将陆续添加到本页面" >> release.txt 86 | 87 | - name: Generate new tag & release 88 | if: steps.check_version.outputs.has_update == 'true' 89 | uses: softprops/action-gh-release@v2 90 | env: 91 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 92 | with: 93 | tag_name: ${{steps.check_version.outputs.latest_version}} 94 | name: ${{steps.check_version.outputs.latest_version}} 95 | target_commitish: ${{ github.ref_name }} 96 | prerelease: ${{steps.check_version.outputs.prerelease}} 97 | body_path: release.txt 98 | 99 | 100 | job_build: 101 | name: Build openwrt-bandix [${{ matrix.platform }}-${{ matrix.ver }}] 102 | needs: job_check 103 | if: needs.job_check.outputs.has_update == 'true' 104 | runs-on: ubuntu-latest 105 | strategy: 106 | fail-fast: false 107 | matrix: 108 | include: 109 | - platform: x86_64 110 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/x86/64/openwrt-sdk-24.10.2-x86-64_gcc-13.3.0_musl.Linux-x86_64.tar.zst 111 | ver: "ipk" 112 | 113 | 114 | - platform: arm_cortex-a5_vfpv4 115 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/at91/sama5/openwrt-sdk-24.10.2-at91-sama5_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 116 | ver: "ipk" 117 | 118 | - platform: arm_cortex-a7 119 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/mediatek/mt7629/openwrt-sdk-24.10.2-mediatek-mt7629_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 120 | ver: "ipk" 121 | 122 | 123 | - platform: arm_cortex-a9 124 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/bcm53xx/generic/openwrt-sdk-24.10.2-bcm53xx-generic_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 125 | ver: "ipk" 126 | 127 | - platform: arm_cortex-a9_neon 128 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/zynq/generic/openwrt-sdk-24.10.2-zynq-generic_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 129 | ver: "ipk" 130 | 131 | - platform: arm_cortex-a9_vfpv3-d16 132 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/mvebu/cortexa9/openwrt-sdk-24.10.2-mvebu-cortexa9_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 133 | ver: "ipk" 134 | 135 | - platform: arm_cortex-a15_neon-vfpv4 136 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/ipq806x/generic/openwrt-sdk-24.10.2-ipq806x-generic_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 137 | ver: "ipk" 138 | 139 | - platform: mips_24kc 140 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/ath79/generic/openwrt-sdk-24.10.2-ath79-generic_gcc-13.3.0_musl.Linux-x86_64.tar.zst 141 | ver: "ipk" 142 | 143 | - platform: mips_4kec 144 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/realtek/rtl838x/openwrt-sdk-24.10.2-realtek-rtl838x_gcc-13.3.0_musl.Linux-x86_64.tar.zst 145 | ver: "ipk" 146 | 147 | - platform: mips_mips32 148 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/bcm53xx/generic/openwrt-sdk-24.10.2-bcm53xx-generic_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 149 | ver: "ipk" 150 | 151 | - platform: mipsel_74kc 152 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/ramips/rt3883/openwrt-sdk-24.10.2-ramips-rt3883_gcc-13.3.0_musl.Linux-x86_64.tar.zst 153 | ver: "ipk" 154 | 155 | - platform: mipsel_mips32 156 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/bcm47xx/generic/openwrt-sdk-24.10.2-bcm47xx-generic_gcc-13.3.0_musl.Linux-x86_64.tar.zst 157 | ver: "ipk" 158 | 159 | 160 | 161 | - platform: arm_cortex-a7_vfpv4 162 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/at91/sama7/openwrt-sdk-24.10.2-at91-sama7_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 163 | ver: "ipk" 164 | 165 | 166 | - platform: arm_arm1176jzf-s_vfp 167 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/bcm27xx/bcm2708/openwrt-sdk-24.10.2-bcm27xx-bcm2708_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 168 | ver: "ipk" 169 | 170 | - platform: aarch64_cortex-a53 171 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/bcm27xx/bcm2710/openwrt-sdk-24.10.2-bcm27xx-bcm2710_gcc-13.3.0_musl.Linux-x86_64.tar.zst 172 | ver: "ipk" 173 | 174 | - platform: aarch64_cortex-a72 175 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/bcm27xx/bcm2711/openwrt-sdk-24.10.2-bcm27xx-bcm2711_gcc-13.3.0_musl.Linux-x86_64.tar.zst 176 | ver: "ipk" 177 | 178 | - platform: aarch64_cortex-a76 179 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/bcm27xx/bcm2712/openwrt-sdk-24.10.2-bcm27xx-bcm2712_gcc-13.3.0_musl.Linux-x86_64.tar.zst 180 | ver: "ipk" 181 | 182 | - platform: riscv64_riscv64 183 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/d1/generic/openwrt-sdk-24.10.2-d1-generic_gcc-13.3.0_musl.Linux-x86_64.tar.zst 184 | ver: "ipk" 185 | 186 | - platform: arm_fa526 187 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/gemini/generic/openwrt-sdk-24.10.2-gemini-generic_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 188 | ver: "ipk" 189 | 190 | 191 | - platform: arm_xscale 192 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/kirkwood/generic/openwrt-sdk-24.10.2-kirkwood-generic_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 193 | ver: "ipk" 194 | 195 | - platform: arm_cortex-a7_neon-vfpv4 196 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/layerscape/armv7/openwrt-sdk-24.10.2-layerscape-armv7_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 197 | ver: "ipk" 198 | 199 | - platform: aarch64_generic 200 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/layerscape/armv8_64b/openwrt-sdk-24.10.2-layerscape-armv8_64b_gcc-13.3.0_musl.Linux-x86_64.tar.zst 201 | ver: "ipk" 202 | 203 | - platform: mipsel_24kc 204 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/malta/le/openwrt-sdk-24.10.2-malta-le_gcc-13.3.0_musl.Linux-x86_64.tar.zst 205 | ver: "ipk" 206 | 207 | - platform: arm_arm926ej-s 208 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/mxs/generic/openwrt-sdk-24.10.2-mxs-generic_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 209 | ver: "ipk" 210 | 211 | 212 | - platform: arm_cortex-a8_vfpv3 213 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/omap/generic/openwrt-sdk-24.10.2-omap-generic_gcc-13.3.0_musl_eabi.Linux-x86_64.tar.zst 214 | ver: "ipk" 215 | 216 | - platform: mipsel_24kc_24kf 217 | url_sdk: https://downloads.openwrt.org/releases/24.10.2/targets/pistachio/generic/openwrt-sdk-24.10.2-pistachio-generic_gcc-13.3.0_musl.Linux-x86_64.tar.zst 218 | ver: "ipk" 219 | 220 | - platform: x86_64 221 | url_sdk: https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-sdk-x86-64_gcc-14.3.0_musl.Linux-x86_64.tar.zst 222 | ver: "apk" 223 | 224 | 225 | 226 | - platform: arm_cortex-a15_neon-vfpv4 227 | url_sdk: https://downloads.openwrt.org/snapshots/targets/armsr/armv7/openwrt-sdk-armsr-armv7_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst 228 | ver: "apk" 229 | 230 | 231 | - platform: arm_cortex-a5_vfpv4 232 | url_sdk: https://downloads.openwrt.org/snapshots/targets/at91/sama5/openwrt-sdk-at91-sama5_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst 233 | ver: "apk" 234 | 235 | - platform: arm_cortex-a7_vfpv4 236 | url_sdk: https://downloads.openwrt.org/snapshots/targets/at91/sama7/openwrt-sdk-at91-sama7_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst 237 | ver: "apk" 238 | 239 | - platform: mips_24kc 240 | url_sdk: https://downloads.openwrt.org/snapshots/targets/ath79/generic/openwrt-sdk-ath79-generic_gcc-14.3.0_musl.Linux-x86_64.tar.zst 241 | ver: "apk" 242 | 243 | - platform: arm_arm1176jzf-s_vfp 244 | url_sdk: https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2708/openwrt-sdk-bcm27xx-bcm2708_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst 245 | ver: "apk" 246 | 247 | - platform: arm_cortex-a7_neon-vfpv4 248 | url_sdk: https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2709/openwrt-sdk-bcm27xx-bcm2709_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst 249 | ver: "apk" 250 | 251 | - platform: aarch64_cortex-a53 252 | url_sdk: https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2710/openwrt-sdk-bcm27xx-bcm2710_gcc-14.3.0_musl.Linux-x86_64.tar.zst 253 | ver: "apk" 254 | 255 | - platform: aarch64_cortex-a72 256 | url_sdk: https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/openwrt-sdk-bcm27xx-bcm2711_gcc-14.3.0_musl.Linux-x86_64.tar.zst 257 | ver: "apk" 258 | 259 | - platform: aarch64_cortex-a76 260 | url_sdk: https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2712/openwrt-sdk-bcm27xx-bcm2712_gcc-14.3.0_musl.Linux-x86_64.tar.zst 261 | ver: "apk" 262 | 263 | - platform: mipsel_mips32 264 | url_sdk: https://downloads.openwrt.org/snapshots/targets/bcm47xx/generic/openwrt-sdk-bcm47xx-generic_gcc-14.3.0_musl.Linux-x86_64.tar.zst 265 | ver: "apk" 266 | 267 | - platform: mipsel_74kc 268 | url_sdk: https://downloads.openwrt.org/snapshots/targets/bcm47xx/mips74k/openwrt-sdk-bcm47xx-mips74k_gcc-14.3.0_musl.Linux-x86_64.tar.zst 269 | ver: "apk" 270 | 271 | - platform: arm_cortex-a9 272 | url_sdk: https://downloads.openwrt.org/snapshots/targets/bcm53xx/generic/openwrt-sdk-bcm53xx-generic_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst 273 | ver: "apk" 274 | 275 | - platform: mips_mips32 276 | url_sdk: https://downloads.openwrt.org/snapshots/targets/bmips/bcm6318/openwrt-sdk-bmips-bcm6318_gcc-14.3.0_musl.Linux-x86_64.tar.zst 277 | ver: "apk" 278 | 279 | - platform: riscv64_riscv64 280 | url_sdk: https://downloads.openwrt.org/snapshots/targets/d1/generic/openwrt-sdk-d1-generic_gcc-14.3.0_musl.Linux-x86_64.tar.zst 281 | ver: "apk" 282 | 283 | - platform: arm_fa526 284 | url_sdk: https://downloads.openwrt.org/snapshots/targets/gemini/generic/openwrt-sdk-gemini-generic_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst 285 | ver: "apk" 286 | 287 | - platform: arm_xscale 288 | url_sdk: https://downloads.openwrt.org/snapshots/targets/kirkwood/generic/openwrt-sdk-kirkwood-generic_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst 289 | ver: "apk" 290 | 291 | - platform: aarch64_generic 292 | url_sdk: https://downloads.openwrt.org/snapshots/targets/layerscape/armv8_64b/openwrt-sdk-layerscape-armv8_64b_gcc-14.3.0_musl.Linux-x86_64.tar.zst 293 | ver: "apk" 294 | 295 | - platform: mipsel_24kc 296 | url_sdk: https://downloads.openwrt.org/snapshots/targets/malta/le/openwrt-sdk-malta-le_gcc-14.3.0_musl.Linux-x86_64.tar.zst 297 | ver: "apk" 298 | 299 | - platform: arm_cortex-a7 300 | url_sdk: https://downloads.openwrt.org/snapshots/targets/mediatek/mt7629/openwrt-sdk-mediatek-mt7629_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst 301 | ver: "apk" 302 | 303 | - platform: arm_arm926ej-s 304 | url_sdk: https://downloads.openwrt.org/snapshots/targets/mxs/generic/openwrt-sdk-mxs-generic_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst 305 | ver: "apk" 306 | 307 | 308 | - platform: mipsel_24kc_24kf 309 | url_sdk: https://downloads.openwrt.org/snapshots/targets/pistachio/generic/openwrt-sdk-pistachio-generic_gcc-14.3.0_musl.Linux-x86_64.tar.zst 310 | ver: "apk" 311 | 312 | - platform: mips_4kec 313 | url_sdk: https://downloads.openwrt.org/snapshots/targets/realtek/rtl838x/openwrt-sdk-realtek-rtl838x_gcc-14.3.0_musl.Linux-x86_64.tar.zst 314 | ver: "apk" 315 | 316 | - platform: arm_cortex-a8_vfpv3 317 | url_sdk: https://downloads.openwrt.org/snapshots/targets/sunxi/cortexa8/openwrt-sdk-sunxi-cortexa8_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst 318 | ver: "apk" 319 | 320 | - platform: arm_cortex-a9_vfpv3-d16 321 | url_sdk: https://downloads.openwrt.org/snapshots/targets/tegra/generic/openwrt-sdk-tegra-generic_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst 322 | ver: "apk" 323 | 324 | - platform: arm_cortex-a9_neon 325 | url_sdk: https://downloads.openwrt.org/snapshots/targets/zynq/generic/openwrt-sdk-zynq-generic_gcc-14.3.0_musl_eabi.Linux-x86_64.tar.zst 326 | ver: "apk" 327 | steps: 328 | - name: Checkout 329 | uses: actions/checkout@main 330 | with: 331 | fetch-depth: 0 332 | 333 | - name: Install packages 334 | run: | 335 | sudo -E rm -rf /usr/share/dotnet /etc/mysql /etc/php /usr/local/lib/android 336 | echo "Install packages" 337 | sudo -E apt-get -qq update 338 | sudo -E apt-get -qq install ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \ 339 | bzip2 ccache clang cmake cpio curl device-tree-compiler ecj fastjar flex gawk gettext gcc-multilib \ 340 | g++-multilib git gnutls-dev gperf haveged help2man intltool lib32gcc-s1 libc6-dev-i386 libelf-dev \ 341 | libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses-dev libpython3-dev \ 342 | libreadline-dev libssl-dev libtool libyaml-dev libz-dev lld llvm lrzsz mkisofs msmtp nano \ 343 | ninja-build p7zip p7zip-full patch pkgconf python3 python3-pip python3-ply python3-docutils \ 344 | python3-pyelftools qemu-utils re2c rsync scons squashfs-tools subversion swig texinfo uglifyjs \ 345 | upx-ucl unzip vim wget xmlto xxd zlib1g-dev zstd 346 | sudo -E apt-get -qq autoremove --purge 347 | sudo -E apt-get -qq clean 348 | 349 | - name: Download and extract SDK 350 | run: | 351 | wget ${{ matrix.url_sdk }} 352 | file_name=$(echo ${{ matrix.url_sdk }} | awk -F/ '{print $NF}') 353 | mkdir -p sdk 354 | if [[ $file_name == *.tar.xz ]]; then 355 | tar -xJf $file_name -C ./sdk --strip-components=1 356 | elif [[ $file_name == *.tar.zst ]]; then 357 | tar --zstd -x -f $file_name -C ./sdk --strip-components=1 358 | else 359 | echo "Unsupported file format: $file_name" 360 | exit 1 361 | fi 362 | rm -f $file_name 363 | 364 | - name: Initialize SDK environment 365 | run: | 366 | cd sdk 367 | 368 | # Update feeds to github source 369 | sed -i \ 370 | -e 's|git\.openwrt\.org/feed|github.com/openwrt|g' \ 371 | -e 's|git\.openwrt\.org/project|github.com/openwrt|g' \ 372 | -e 's|git\.openwrt\.org/openwrt|github.com/openwrt|g' \ 373 | "feeds.conf.default" 374 | 375 | ./scripts/feeds update -a 376 | ./scripts/feeds install -a 377 | 378 | #--------------------------------------begin_patches------------------------------------------ 379 | echo "Start applying the patch" 380 | 381 | rm -rf temp_resp 382 | git clone -b master --single-branch https://github.com/openwrt/packages.git temp_resp 383 | echo "update golang version" 384 | rm -rf feeds/packages/lang/golang 385 | cp -r temp_resp/lang/golang feeds/packages/lang 386 | echo "update rust version" 387 | rm -rf feeds/packages/lang/rust 388 | cp -r temp_resp/lang/rust feeds/packages/lang 389 | rm -rf temp_resp 390 | 391 | echo "update patch-kernel.sh" 392 | git clone -b main --single-branch https://github.com/openwrt/openwrt.git temp_resp 393 | cp -f temp_resp/scripts/patch-kernel.sh scripts/ 394 | rm -rf temp_resp 395 | 396 | echo "Patch application completed" 397 | #--------------------------------------end_patches-------------------------------------------- 398 | 399 | - name: Update source code 400 | run: | 401 | cd sdk 402 | # 更新源码(每次都需要最新代码) 403 | rm -rf ./package/custom_packages/openwrt-bandix 404 | mkdir -p ./package/custom_packages 405 | git clone https://github.com/timsaya/openwrt-bandix.git ./package/custom_packages/openwrt-bandix 406 | 407 | - name: Compile 408 | id: compile 409 | run: | 410 | cd sdk 411 | echo "CONFIG_ALL_NONSHARED=n" > .config 412 | echo "CONFIG_ALL_KMODS=n" >> .config 413 | echo "CONFIG_ALL=n" >> .config 414 | echo "CONFIG_AUTOREMOVE=n" >> .config 415 | echo "CONFIG_LUCI_LANG_zh_Hans=y" >> .config 416 | echo "CONFIG_PACKAGE_bandix=m" >> .config 417 | 418 | make defconfig 419 | 420 | # 1) 编译 openwrt-bandix(先 clean 再 compile) 421 | make package/custom_packages/openwrt-bandix/openwrt-bandix/{clean,compile} -j$(nproc) V=s || { 422 | echo "编译 openwrt-bandix 失败,仍将尝试检查产物" 423 | } 424 | 425 | # 2) 获取架构信息 426 | arch="" 427 | if [ -f .config ]; then 428 | arch=$(grep "CONFIG_TARGET_ARCH_PACKAGES=" ".config" | cut -d '"' -f2) 429 | fi 430 | 431 | if [ -z "$arch" ]; then 432 | echo "未能从 .config 解析到 CONFIG_TARGET_ARCH_PACKAGES,尝试从路径获取" 433 | # 尝试从 bin/packages 目录结构获取架构 434 | arch=$(find bin/packages -mindepth 1 -maxdepth 1 -type d ! -name ".*" | head -1 | xargs basename) 435 | fi 436 | 437 | if [ -z "$arch" ]; then 438 | echo "无法确定架构信息,使用默认路径" 439 | arch="*" 440 | fi 441 | 442 | echo "检测到架构: [$arch]" 443 | 444 | # 3) 检查产物路径(优先 custom,其次 base) 445 | BIN_DIR_CUSTOM="bin/packages/$arch/custom" 446 | BIN_DIR_BASE="bin/packages/$arch/base" 447 | 448 | mkdir -p upload 449 | 450 | # 查找产物(ipk 或 apk),兼容连字符和下划线命名 451 | found_pkgs=() 452 | if [ -d "$BIN_DIR_CUSTOM" ]; then 453 | while IFS= read -r -d '' pkg; do 454 | found_pkgs+=("$pkg") 455 | done < <(find "$BIN_DIR_CUSTOM" -maxdepth 1 -type f \( -name 'bandix-*.ipk' -o -name 'bandix-*.apk' -o -name 'bandix_*.ipk' -o -name 'bandix_*.apk' \) -print0 2>/dev/null) 456 | fi 457 | 458 | if [ ${#found_pkgs[@]} -eq 0 ] && [ -d "$BIN_DIR_BASE" ]; then 459 | while IFS= read -r -d '' pkg; do 460 | found_pkgs+=("$pkg") 461 | done < <(find "$BIN_DIR_BASE" -maxdepth 1 -type f \( -name 'bandix-*.ipk' -o -name 'bandix-*.apk' -o -name 'bandix_*.ipk' -o -name 'bandix_*.apk' \) -print0 2>/dev/null) 462 | fi 463 | 464 | if [ ${#found_pkgs[@]} -eq 0 ]; then 465 | echo "未找到 openwrt-bandix 的 ipk/apk 产物" 466 | exit 1 467 | fi 468 | 469 | # 4) 复制并重命名产物 470 | for pkg in "${found_pkgs[@]}"; do 471 | filename="$(basename "$pkg")" 472 | ext="${filename##*.}" 473 | name_no_ext="${filename%.*}" 474 | 475 | # 转义架构名称中的特殊字符用于正则表达式匹配 476 | arch_escaped=$(echo "$arch" | sed 's/[.*+?^${}()|[\]\\]/\\&/g') 477 | 478 | # 若文件名末尾尚未包含 _${arch} 或 -${arch},则在扩展名前追加 _${arch} 479 | if [[ "$name_no_ext" =~ (^|[_-])${arch_escaped}$ ]]; then 480 | new_name="$filename" 481 | else 482 | new_name="${name_no_ext}_${arch}.${ext}" 483 | fi 484 | 485 | echo "复制产物: $pkg -> upload/$new_name" 486 | cp -f "$pkg" "upload/$new_name" || { 487 | echo "复制失败: $pkg" 488 | exit 1 489 | } 490 | done 491 | 492 | if [ ! -d "upload" ] || [ -z "$(ls -A upload 2>/dev/null)" ]; then 493 | echo "错误: upload 目录不存在或为空" 494 | exit 1 495 | fi 496 | 497 | cd upload 498 | echo "status=success" >> $GITHUB_OUTPUT 499 | echo "FIRMWARE=$PWD" >> $GITHUB_ENV 500 | 501 | - name: Upload to release 502 | uses: softprops/action-gh-release@v2 503 | if: steps.compile.outputs.status == 'success' 504 | env: 505 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 506 | with: 507 | tag_name: ${{needs.job_check.outputs.openwrt-bandix_version}} 508 | files: ${{ env.FIRMWARE }}/* 509 | --------------------------------------------------------------------------------