127 lines
3.9 KiB
YAML
127 lines
3.9 KiB
YAML
name: OpenWrt Builder
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
device:
|
|
description: 'Target device (all = build all devices)'
|
|
required: false
|
|
type: choice
|
|
default: all
|
|
options:
|
|
- all
|
|
- uz801
|
|
- uf02
|
|
|
|
env:
|
|
UPLOAD_FIRMWARE: true
|
|
TZ: Europe/Madrid
|
|
|
|
jobs:
|
|
resolve-version:
|
|
runs-on: ubuntu-22.04
|
|
outputs:
|
|
openwrt_version: ${{ steps.resolve.outputs.version }}
|
|
steps:
|
|
- name: Resolve latest stable OpenWrt 25.12.x tag
|
|
id: resolve
|
|
run: |
|
|
VERSION=$(git ls-remote --tags https://git.openwrt.org/openwrt/openwrt.git 'v25.12.*' \
|
|
| grep -oP 'v25\.12\.\d+$' | sort -V | tail -1)
|
|
if [ -z "$VERSION" ]; then
|
|
echo "ERROR: Could not resolve a stable OpenWrt 25.12.x version"
|
|
exit 1
|
|
fi
|
|
echo "Resolved OpenWrt version: $VERSION"
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
build:
|
|
needs: resolve-version
|
|
runs-on: ubuntu-22.04
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
device: ${{ fromJSON((inputs.device == 'all' || inputs.device == '') && '["uz801","uf02"]' || format('["{0}"]', inputs.device)) }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Initialization environment
|
|
env:
|
|
DEBIAN_FRONTEND: noninteractive
|
|
run: |
|
|
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
|
|
sudo docker image prune --all --force
|
|
sudo -E apt-get -qq update
|
|
sudo -E ./devenv/dependencies.sh
|
|
sudo -E apt-get -qq autoremove --purge
|
|
sudo -E apt-get -qq clean
|
|
sudo timedatectl set-timezone "$TZ"
|
|
|
|
- name: Clone OpenWrt source code
|
|
run: |
|
|
echo "Using OpenWrt ${{ needs.resolve-version.outputs.openwrt_version }}"
|
|
git clone https://git.openwrt.org/openwrt/openwrt.git openwrt
|
|
git -C openwrt checkout ${{ needs.resolve-version.outputs.openwrt_version }}
|
|
|
|
- name: Load msm89xx target and packages
|
|
run: |
|
|
chmod +x apply_patches.sh
|
|
./apply_patches.sh openwrt
|
|
mv msm89xx openwrt/target/linux/msm89xx
|
|
mv packages openwrt/package/msm8916
|
|
|
|
- name: Update and install feeds
|
|
run: |
|
|
cd openwrt
|
|
rm -rf tmp
|
|
./scripts/feeds update -a
|
|
./scripts/feeds install -a
|
|
|
|
- name: Load diffconfig
|
|
run: |
|
|
DEVICE="${{ matrix.device }}"
|
|
DIFFCONFIG="diffconfig_${DEVICE}"
|
|
[ -f "$DIFFCONFIG" ] && mv "$DIFFCONFIG" openwrt/.config
|
|
|
|
- name: Download package
|
|
id: package
|
|
run: |
|
|
cd openwrt
|
|
make defconfig
|
|
make download -j8
|
|
find dl -size -1024c -exec rm -f {} \; || true
|
|
|
|
- name: Compile the firmware
|
|
id: compile
|
|
run: |
|
|
cd openwrt
|
|
echo -e "$(nproc) thread compile"
|
|
make -j$(nproc) || make -j1 || make -j1 V=s
|
|
echo "status=success" >> $GITHUB_OUTPUT
|
|
echo "FILE_DATE=$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
|
|
|
|
- name: Organize files
|
|
id: organize
|
|
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled()
|
|
run: |
|
|
cd openwrt/bin/targets/*/*
|
|
rm -rf packages
|
|
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
|
|
echo "status=success" >> $GITHUB_OUTPUT
|
|
|
|
- name: Upload firmware
|
|
uses: actions/upload-artifact@v4
|
|
if: steps.organize.outputs.status == 'success' && !cancelled()
|
|
with:
|
|
name: openwrt_firmware_${{ matrix.device }}_${{needs.resolve-version.outputs.openwrt_version}}_${{ env.FILE_DATE }}
|
|
path: |
|
|
${{ env.FIRMWARE }}/openwrt-msm89xx-*-squashfs-gpt_both0.bin
|
|
${{ env.FIRMWARE }}/openwrt-msm89xx-*-squashfs-boot.img
|
|
${{ env.FIRMWARE }}/openwrt-msm89xx-*-squashfs-system.img
|
|
${{ env.FIRMWARE }}/openwrt-msm89xx-*.manifest
|
|
${{ env.FIRMWARE }}/openwrt-msm89xx-*-flash.sh
|
|
${{ env.FIRMWARE }}/openwrt-msm89xx-*-firmware.zip
|