name: build-N1 on: workflow_dispatch: inputs: openwrt_kernel: description: "选择构建的内核" required: false default: "6.1.146" type: choice options: - 5.15.189 - 6.1.146 - 6.6.93 - 6.12.39 include_docker: description: | 是否编译 Docker 插件 required: true default: 'no' type: choice options: - 'yes' - 'no' replace_banner: description: '是否替换为ImmortalWrt的banner信息' required: false default: false type: boolean rootfs_partsize: description: '软件包大小1G固定' required: true default: "1024" type: choice options: - '1024' jobs: build: runs-on: ubuntu-22.04 steps: - name: Checkout code uses: actions/checkout@v3 - name: Set executable permissions run: chmod +x ${{ github.workspace }}/n1/build.sh - name: Debug workspace contents run: ls -R - name: 处理是否替换banner信息 if: ${{ github.event.inputs.replace_banner == 'true' }} run: | cp n1/99-banner.sh files/etc/uci-defaults/ - name: Building N1 ImmortalWrt run: | profiles="generic" include_docker="${{ github.event.inputs.include_docker }}" rootfs_partsize="${{ github.event.inputs.rootfs_partsize }}" IFS=',' read -r -a profile_array <<< "$profiles" for profile in "${profile_array[@]}"; do echo "Building for profile: $profile" docker run --rm -i \ --user root \ -v "${{ github.workspace }}/bin:/home/build/immortalwrt/bin" \ -v "${{ github.workspace }}/files/etc/uci-defaults:/home/build/immortalwrt/files/etc/uci-defaults" \ -v "${{ github.workspace }}/arch/arch.conf:/home/build/immortalwrt/files/etc/opkg/arch.conf" \ -v "${{ github.workspace }}/shell:/home/build/immortalwrt/shell" \ -v "${{ github.workspace }}/n1/banner:/home/build/immortalwrt/files/mnt/banner" \ -v "${{ github.workspace }}/n1/imm.config:/home/build/immortalwrt/.config" \ -v "${{ github.workspace }}/n1/build.sh:/home/build/immortalwrt/build.sh" \ -e PROFILE=$profile \ -e INCLUDE_DOCKER=$include_docker \ -e ROOTFS_PARTSIZE=$rootfs_partsize \ immortalwrt/imagebuilder:armsr-armv8-openwrt-24.10.2 /bin/bash /home/build/immortalwrt/build.sh done - name: 查找rootfs.tar.gz所在路径 id: find_rootfs run: | ROOTFS_FILE=$(find bin/targets/armsr/armv8/ -type f -name "*rootfs.tar.gz" | head -n1) echo "✅ Found: $ROOTFS_FILE" if [ ! -f "$ROOTFS_FILE" ]; then echo "❌ 找不到 rootfs.tar.gz 文件" exit 1 fi echo "file=$ROOTFS_FILE" >> $GITHUB_OUTPUT - name: Package armsr-armv8 as ImmortalWrt for N1 uses: ophub/flippy-openwrt-actions@main if: ${{ steps.down.outputs.status }} == 'success' && !cancelled() env: OPENWRT_ARMVIRT: ${{ steps.find_rootfs.outputs.file }} PACKAGE_SOC: s905d KERNEL_VERSION_NAME: ${{ inputs.openwrt_kernel }} WHOAMI: "wukongdaily" - name: Rename .img.gz file id: rename run: | FILE=$(ls ${{ env.PACKAGED_OUTPUTPATH }}/*.img.gz | head -n1) echo "Image file is: $FILE" FILENAME=$(basename "$FILE") echo "FILENAME=$FILENAME" >> $GITHUB_ENV KERNEL_VERSION=$(echo "$FILENAME" | grep -oP 'k\d+\.\d+\.\d+') mv "$FILE" "${{ env.PACKAGED_OUTPUTPATH }}/immortalwrt-24.10.2-phicomm-n1-btrfs-$KERNEL_VERSION.img.gz" - name: Upload firmware to GitHub Releases uses: softprops/action-gh-release@v2.2.1 with: tag_name: phicomm-n1 name: ImmortalWrt for Phicomm N1 body_path: ${{ github.workspace }}/n1/info.md files: | ${{ env.PACKAGED_OUTPUTPATH }}/*.img.gz ${{ github.workspace }}/bin/targets/armsr/armv8/*rootfs.tar.gz env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}