Skip to content

OpenWrt for R2S self-hosted #8

OpenWrt for R2S self-hosted

OpenWrt for R2S self-hosted #8

name: OpenWrt for R2S self-hosted
on: workflow_dispatch
env:
UPLOAD_FIRMWARE: true
TZ: Asia/Shanghai
MYOPENWRTTARGET: R2S
jobs:
build:
runs-on: [self-hosted, Linux, X64]
if: github.event.repository.owner.id == github.event.sender.id
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: 'master'
- name: Prepare OpenWrt
run: |
cp -f ./SCRIPTS/01_get_ready.sh ./01_get_ready.sh
echo "FMDATETIME=$(date '+%Y%m%d-%H%M')" >> $GITHUB_ENV
/bin/bash ./01_get_ready.sh
- name: Prepare Package
run: |
cp -f ./SCRIPTS/*.sh ./openwrt/
cd openwrt
/bin/bash ./02_prepare_package.sh
- name: Remove Upx
run: |
cd openwrt
/bin/bash ./03_remove_upx.sh
- name: Convert Translation
run: |
cd openwrt
/bin/bash ./04_convert_translation.sh
- name: Add ACL
run: |
cd openwrt
/bin/bash ./05_create_acl_for_luci.sh -a
- name: Make Config
run: |
cd openwrt
cp -f ../SEED/R2S.config.seed .config
cat ../SEED/more.seed >> .config
make defconfig
- name: Make Download
run: |
df -h
cd openwrt && make download -j20
echo $?
- name: Make Toolchain
id: maketoolchain
continue-on-error: true
run: |
df -h
cd openwrt && make toolchain/install -j$(($(nproc) + 1))
echo $?
/bin/ls -AF staging_dir/toolchain-*/bin/
- name: If Toolchain Error
if: steps.maketoolchain.outcome == 'failure'
run: |
df -h
cd openwrt && make toolchain/install -j1 V=s
- name: Compile OpenWrt
id: compileopenwrt
continue-on-error: true
run: |
df -h
cd openwrt && make -j$(($(nproc) + 1)) V=w
echo $?
- name: If Compiling Error
if: steps.compileopenwrt.outcome == 'failure'
run: |
df -h
cat openwrt/.config
echo '================================================================'
cd openwrt && make -j1 V=s
- name: Cleaning and hashing
run: |
rm -rf ./artifact && mkdir -p ./artifact
cd ./artifact
echo "FIRMWAREDIR=$(pwd)" >> $GITHUB_ENV
cd ../openwrt
cp -f ../clean_flash.sh ../artifact/clean_flash.sh
cp -f .config ../artifact/kconfig-full
/bin/bash ./scripts/diffconfig.sh > ../artifact/kconfig-lite
cd bin/targets/rockchip/armv8
ls -Ahl
/bin/bash ../../../../../SCRIPTS/06_cleaning.sh
mv -f ./* ../../../../../artifact/
echo "status=success" >> $GITHUB_OUTPUT
- name: Upload Firmwares
uses: actions/upload-artifact@v4
if: env.UPLOAD_FIRMWARE == 'true' && ${{ success() }}
with:
name: OpenWrt_R2S_${{ env.FMDATETIME }}
path: ${{ env.FIRMWAREDIR }}