Skip to content

Build OpenWrt

Build OpenWrt #184

Workflow file for this run

#
# This is free software, licence use MIT.
#
# Copyright (C) 2019 P3TERX <https://p3terx.com>
# Copyright (C) 2020 KFERMercer <[email protected]>
# Copyright (C) 2024 Muhan Li <[email protected]>
#
# <https://github.com/muhac/openwrt-action>
#
name: Build OpenWrt
on:
push:
branches:
- '**'
schedule:
- cron: 0 0 * * FRI
release:
types:
- published
jobs:
build_openwrt:
name: Build OpenWrt Firmware
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.ref }}
uses: actions/checkout@v4
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
- name: Check free space
run: df -Th
# Recommended package prerequisites
# https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem#debianubuntu
- name: Initialization
run: |
sudo apt-get update
sudo apt-get install -y build-essential clang flex bison g++ gawk \
gcc-multilib g++-multilib gettext git libncurses-dev libssl-dev \
python3-setuptools mkisofs rsync unzip zlib1g-dev file wget qemu-utils
sudo apt-get clean
- name: Load settings
run: cp -r ./settings ../settings
# Set the upstream repo and a branch or tag
- name: OpenWrt source code
uses: actions/checkout@v4
with:
repository: 'immortalwrt/immortalwrt'
ref: 'v24.10.0'
- name: Configure basic packages
run: bash ../settings/basic.sh
- name: Configure extra packages
run: bash ../settings/extra.sh
- name: Configuration settings
run: cat ../settings/system.conf
- name: Update feeds
run: |
./scripts/feeds update -a
./scripts/feeds install -a
- name: Generate config
run: |
rm -f ./.config*
cp ../settings/system.conf ./.config
make defconfig
- name: Overwrite config
run: bash ../settings/system.sh
- name: Check build config
run: cat ./.config
- name: Check system config
run: cat ./package/base-files/files/bin/config_generate
- name: Make download
run: make download -j$(nproc) || make download -j1 V=s
- name: Compile firmware
run: make -j$(nproc) || make -j1 V=s
- name: Build results
run: tree -a ./bin/targets/
- name: Space usage
run: du -h ./ --max-depth=1
- name: Disk space remaining
run: df -h
- name: Prepare artifact
run: |
echo "now=$(date '+%Y%m%d_%H%M%S')" >> $GITHUB_ENV
mkdir -p ./artifact/firmware
mkdir -p ./artifact/package
mkdir -p ./artifact/buildinfo
rm -rf $(find ./bin/targets/ -type d -name "packages")
cp -rf $(find ./bin/targets/ -type f) ./artifact/firmware/
cp -rf $(find ./bin/packages/ -type f -name "*.ipk") ./artifact/package/
cp -rf $(find ./bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/
- name: Deliver buildinfo
uses: actions/upload-artifact@v4
with:
name: OpenWrt_buildinfo_${{ github.ref_name }}_${{ env.now }}
path: ./artifact/buildinfo/
- name: Deliver package
uses: actions/upload-artifact@v4
with:
name: OpenWrt_package_${{ github.ref_name }}_${{ env.now }}
path: ./artifact/package/
- name: Deliver firmware
uses: actions/upload-artifact@v4
with:
name: OpenWrt_firmware_${{ github.ref_name }}_${{ env.now }}
path: ./artifact/firmware/
- name: Upload release asset
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@v2
with:
file: ./artifact/firmware/*
tag: ${{ github.ref }}
file_glob: true