name: OpenWrt Package on: push: workflow_dispatch: inputs: arch: description: "Target architecture (leave empty to build all)" required: false default: "" env: CARGO_TERM_COLOR: always jobs: build: name: Build .ipk (${{ matrix.openwrt_arch }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - build_arch: aarch64 openwrt_arch: aarch64_cortex-a53 rust_target: aarch64-unknown-linux-musl rust_channel: stable # MT3000, MT6000, Flint 2, RPi 3/4/5 # MIPS disabled: 32-bit MIPS lacks AtomicU64; needs portable-atomic crate # - build_arch: mipsel # openwrt_arch: mipsel_24kc # rust_target: mipsel-unknown-linux-musl # rust_channel: nightly # - build_arch: mips # openwrt_arch: mips_24kc # rust_target: mips-unknown-linux-musl # rust_channel: nightly - build_arch: x86_64 openwrt_arch: x86_64 rust_target: x86_64-unknown-linux-musl rust_channel: stable # x86 routers / VMs steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Derive package version id: version run: | if [[ "$GITHUB_REF" == refs/tags/* ]]; then VERSION="${GITHUB_REF_NAME#v}" else BRANCH=$(echo "$GITHUB_REF_NAME" | sed 's|/|-|g') HEIGHT=$(git rev-list --count HEAD) HASH=$(git rev-parse --short HEAD) VERSION="${BRANCH}.${HEIGHT}.${HASH}" fi echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "filename=fips_${VERSION}_${{ matrix.openwrt_arch }}.ipk" >> "$GITHUB_OUTPUT" - name: Install Rust toolchain (stable) if: matrix.rust_channel == 'stable' uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.rust_target }} - name: Install Rust toolchain (nightly, Tier 3) if: matrix.rust_channel == 'nightly' uses: dtolnay/rust-toolchain@nightly with: components: rust-src - name: Cache Cargo registry + build uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git target/${{ matrix.rust_target }} key: openwrt-${{ matrix.rust_target }}-${{ hashFiles('**/Cargo.lock') }} restore-keys: | openwrt-${{ matrix.rust_target }}- - name: Install cargo-zigbuild run: cargo install cargo-zigbuild --locked - name: Install zig (required by cargo-zigbuild) uses: goto-bus-stop/setup-zig@v2 - name: Install llvm-strip run: sudo apt-get install -y --no-install-recommends llvm - name: Build .ipk env: PKG_VERSION: ${{ steps.version.outputs.version }} LLVM_STRIP: llvm-strip run: ./packaging/openwrt-ipk/build-ipk.sh --arch ${{ matrix.build_arch }} - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ${{ steps.version.outputs.filename }} path: dist/${{ steps.version.outputs.filename }} retention-days: 30 release: name: Publish GitHub Release runs-on: ubuntu-latest needs: build if: startsWith(github.ref, 'refs/tags/') permissions: contents: write steps: - name: Download all .ipk artifacts uses: actions/download-artifact@v4 with: path: dist merge-multiple: true - name: Create release uses: softprops/action-gh-release@v2 with: files: dist/*.ipk generate_release_notes: true