|
| 1 | +# 此工作流是为了构建一个immortalwrt固件的安装器 格式为iso 可用于所有的虚拟机 和 物理机 |
| 2 | +# 所谓安装器就是用来安装用的 iso引导的是一个启动速度极快的debian live系统 跑码后输入命令 ddd 即可调出安装菜单 |
| 3 | +# 安装时 若是多张硬盘 你可以选择 需要安装的硬盘 此类方法安装的openwrt 安装后是有剩余空间的 更多信息请参考 wukongdaily/img-installer 项目 |
| 4 | +# 几乎所有linux 都有各自的安装器 唯独openwrt和armbian 没有, 希望此工作流 弥补这个遗憾 让你更优雅的 安装openwrt |
| 5 | + |
| 6 | +name: build 25.12.x ISO |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + luci_version: |
| 12 | + description: "选择luci版本" |
| 13 | + required: false |
| 14 | + default: "25.12.0-rc2" |
| 15 | + type: choice |
| 16 | + options: |
| 17 | + - 25.12.0-rc1 |
| 18 | + - 25.12.0-rc2 |
| 19 | + profile: |
| 20 | + description: '请输入要编译固件大小 单位(MB)' |
| 21 | + required: true |
| 22 | + default: '1024' |
| 23 | + include_docker: |
| 24 | + description: "是否编译 Docker 插件" |
| 25 | + required: true |
| 26 | + default: 'yes' |
| 27 | + type: choice |
| 28 | + options: |
| 29 | + - 'yes' |
| 30 | + - 'no' |
| 31 | + enable_pppoe: |
| 32 | + description: "是否配置PPPoE拨号信息?" |
| 33 | + required: true |
| 34 | + default: 'no' |
| 35 | + type: choice |
| 36 | + options: |
| 37 | + - 'yes' |
| 38 | + - 'no' |
| 39 | + pppoe_account: |
| 40 | + description: "宽带账号 (若启用PPPoE)" |
| 41 | + required: false |
| 42 | + pppoe_password: |
| 43 | + description: "宽带密码 (若启用PPPoE)" |
| 44 | + required: false |
| 45 | + |
| 46 | +jobs: |
| 47 | + build_immortalwrt: |
| 48 | + runs-on: ubuntu-22.04 |
| 49 | + |
| 50 | + steps: |
| 51 | + - name: Checkout code |
| 52 | + uses: actions/checkout@v3 |
| 53 | + |
| 54 | + - name: Set executable permissions |
| 55 | + run: chmod +x ${{ github.workspace }}/x86-64/build25.sh |
| 56 | + |
| 57 | + - name: Validate PPPoE Inputs |
| 58 | + run: | |
| 59 | + if [[ "${{ github.event.inputs.enable_pppoe }}" == "yes" ]]; then |
| 60 | + if [[ -z "${{ github.event.inputs.pppoe_account }}" || -z "${{ github.event.inputs.pppoe_password }}" ]]; then |
| 61 | + echo "Error: PPPoE account and password must be provided when PPPoE is enabled!" |
| 62 | + exit 1 |
| 63 | + fi |
| 64 | + fi |
| 65 | +
|
| 66 | + - name: ✅ 正在构建ImmortalWrt固件25.12.x |
| 67 | + run: | |
| 68 | + profiles="${{ github.event.inputs.profile }}" |
| 69 | + include_docker="${{ github.event.inputs.include_docker }}" |
| 70 | + luci_version="${{ github.event.inputs.luci_version }}" |
| 71 | + IFS=',' read -r -a profile_array <<< "$profiles" |
| 72 | + |
| 73 | + for profile in "${profile_array[@]}"; do |
| 74 | + echo "Building for profile: $profile" |
| 75 | + docker run --rm -i \ |
| 76 | + --user root \ |
| 77 | + -v "${{ github.workspace }}/bin:/home/build/immortalwrt/bin" \ |
| 78 | + -v "${{ github.workspace }}/files:/home/build/immortalwrt/files" \ |
| 79 | + -v "${{ github.workspace }}/x86-64/imm.config:/home/build/immortalwrt/.config" \ |
| 80 | + -v "${{ github.workspace }}/shell:/home/build/immortalwrt/shell" \ |
| 81 | + -v "${{ github.workspace }}/x86-64/build25.sh:/home/build/immortalwrt/build.sh" \ |
| 82 | + -e PROFILE=$profile \ |
| 83 | + -e INCLUDE_DOCKER=$include_docker \ |
| 84 | + -e ENABLE_PPPOE=${{ inputs.enable_pppoe }} \ |
| 85 | + -e PPPOE_ACCOUNT=${{ inputs.pppoe_account }} \ |
| 86 | + -e PPPOE_PASSWORD=${{ inputs.pppoe_password }} \ |
| 87 | + immortalwrt/imagebuilder:x86-64-openwrt-${luci_version} /bin/bash /home/build/immortalwrt/build.sh |
| 88 | + done |
| 89 | +
|
| 90 | + - name: ✅ 复制固件到根目录 |
| 91 | + run: | |
| 92 | + cp ${{ github.workspace }}/bin/targets/x86/64/*squashfs-combined-efi.img.gz ${{ github.workspace }} |
| 93 | +
|
| 94 | + - name: ✅ 上传固件到 artifact (for ISO generation) |
| 95 | + uses: actions/upload-artifact@v4 |
| 96 | + with: |
| 97 | + name: firmware-img |
| 98 | + path: | |
| 99 | + *.img.gz |
| 100 | +
|
| 101 | + build_installer_iso: |
| 102 | + runs-on: ubuntu-22.04 |
| 103 | + needs: build_immortalwrt |
| 104 | + |
| 105 | + steps: |
| 106 | + - name: Download firmware artifact |
| 107 | + uses: actions/download-artifact@v4 |
| 108 | + with: |
| 109 | + name: firmware-img |
| 110 | + |
| 111 | + - name: ⏬ 同步 img-installer 项目 准备制作ISO |
| 112 | + run: | |
| 113 | + git clone https://github.com/wukongdaily/img-installer.git |
| 114 | + cd img-installer |
| 115 | +
|
| 116 | + - name: Set executable permissions for scripts |
| 117 | + run: | |
| 118 | + chmod +x "${{ github.workspace }}/img-installer/custom.sh" |
| 119 | + chmod +x "${{ github.workspace }}/img-installer/supportFiles/custom/build.sh" |
| 120 | +
|
| 121 | + - name: ✅ 制作 25.12.x ISO |
| 122 | + run: | |
| 123 | + firmware_file=$(ls *squashfs-combined-efi.img.gz) |
| 124 | + cd img-installer |
| 125 | + bash autobuild/autobuild.sh "../$firmware_file" |
| 126 | +
|
| 127 | + - name: 🚀 上传 ISO 到 Release |
| 128 | + uses: softprops/action-gh-release@v2.2.1 |
| 129 | + with: |
| 130 | + tag_name: "Custom-Installer-x86_64-ISO" |
| 131 | + body_path: "${{ github.workspace }}/img-installer/autobuild/info.md" |
| 132 | + files: | |
| 133 | + img-installer/output/custom-installer-x86_64.iso |
| 134 | + token: "${{ secrets.GITHUB_TOKEN }}" |
0 commit comments