Skip to content

Build OpenWrt 23.05 #618

Build OpenWrt 23.05

Build OpenWrt 23.05 #618

Workflow file for this run

name: Build OpenWrt
run-name: Build OpenWrt ${{ github.event.inputs.branch }}
on:
workflow_dispatch:
inputs:
branch:
description: 'your local repo branch'
required: true
default: 23.05
type: choice
options:
- master
- 23.05
targets:
description: 'target devices'
required: true
default: "['amlogic-meson8b', 'x86-64']"
type: choice
options:
- "['amlogic-meson8b']"
- "['amlogic-meson8b', 'x86-64']"
jobs:
build:
runs-on: ubuntu-24.04
strategy:
matrix:
target: ${{ fromJSON(github.event.inputs.targets) }}
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
swap-size-mb: 1024
temp-reserve-mb: 512
root-reserve-mb: 4608
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
- name: Clone Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Init build dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E apt-get -qq update
sudo /bin/bash -c "$(curl -sL https://git.io/vokNn)"
sudo -E apt-fast -y -qq install asciidoc bash bcc bin86 binutils bison bzip2 clang file flex g++ g++-multilib gawk gcc gcc-multilib gettext git gzip help2man intltool libboost-dev libelf-dev libncurses-dev libncurses5-dev libssl-dev libthread-queue-any-perl libusb-dev libxml-parser-perl make patch perl-modules python3-dev python3-pip python3-pyelftools python3-setuptools rsync sharutils swig time unzip util-linux wget xsltproc zlib1g-dev zip
sudo -E apt-fast -y -qq install android-sdk-libsparse-utils dos2unix dwarves quilt
pip3 install --user -U pylibfdt --break-system-packages
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo -E git config --global user.name 'GitHub Actions' && git config --global user.email '[email protected]'
df -h
- name: Clone OpenWrt
run: |
git clone https://github.com/openwrt/openwrt.git
- name: Get variable
working-directory: ./openwrt
id: var
run: |
case ${{ github.event.inputs.branch }} in
master)
_release_tag=snapshot-r$(date +%g.%j)
_prerelease=true
;;
23.05)
_release_tag=$(git tag --sort=taggerdate --list 'v23.*' | tail -1)
git checkout $_release_tag
_prerelease=false
;;
*)
echo "Can't get local/upstream's branch/tags"
;;
esac
case ${{ matrix.target }} in
amlogic-meson8b) _device=onecloud ;;
x86-64) _device=x86-64 ;;
*) echo "wrong devices" ;;
esac
_artifact=${{ matrix.target }}
_artifact_path=openwrt/bin/targets/${_artifact/-//}
echo "release_tag=$_release_tag" >> $GITHUB_OUTPUT
echo "prerelease=$_prerelease" >> $GITHUB_OUTPUT
echo "device=$_device" >> $GITHUB_OUTPUT
echo "artifact=$_artifact_path" >> $GITHUB_OUTPUT
- name: Fetch Other repos
run: |
./scripts/00_init.sh other-repos
- name: Feeds update & install
working-directory: ./openwrt
run: |
./scripts/feeds update -a && ./scripts/feeds install -a
- name: Customize Packages
working-directory: ./openwrt
run: |
cp -L ../scripts/${{ steps.var.outputs.device }}_customization.sh .
cp ../scripts/01_customize_packages.sh .
/bin/bash ${{ steps.var.outputs.device }}_customization.sh
- if: matrix.target == 'x86-64'
name: FullCone Nat
run: |
./scripts/00_init.sh patch-fullconenat
- name: Convert Translation
working-directory: ./openwrt
run: |
cp ../scripts/02_convert_translation.sh .
/bin/bash 02_convert_translation.sh
- name: Get cache toolchain
uses: HiGarfield/cachewrtbuild@main
with:
prefix: ${{ github.workspace }}/openwrt
mixkey: ${{ matrix.target }}
- name: Make Config
working-directory: ./openwrt
run: |
cp ../config/${{ steps.var.outputs.device }}_defconfig .config
make defconfig
- name: Make Download
working-directory: ./openwrt
run: |
make download -j`nproc`
- name: Compile OpenWrt
working-directory: ./openwrt
run: |
make -j`nproc` || make -j1 V=s
- name: Assemble Artifact
run: |
ls ${{ steps.var.outputs.artifact }}
cat ${{ steps.var.outputs.artifact }}/config.buildinfo
rm -rf ${{ steps.var.outputs.artifact }}/{packages,*.buildinfo,*.json,*.manifest,*kernel.bin,*-rootfs.*,sha256sums}
- if: matrix.target == 'amlogic-meson8b'
name: Assemble burn firmware
run: |
./scripts/00_init.sh burn-onecloud
- name: Upload Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
target_commitish: ${{ github.event.inputs.branch }}
prerelease: ${{ steps.var.outputs.prerelease }}
tag_name: ${{ steps.var.outputs.release_tag }}
files: ${{ steps.var.outputs.artifact }}/*