openwrt-rockchip-docker #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#================================================= | |
# https://github.com/P3TERX/Actions-OpenWrt | |
# Description: Build OpenWrt using GitHub Actions | |
# Lisence: MIT | |
# Author: P3TERX | |
# Blog: https://p3terx.com | |
#================================================= | |
name: openwrt-rockchip-docker | |
on: | |
repository_dispatch: | |
workflow_dispatch: | |
#schedule: | |
#- cron: 0 17 * * * | |
# watch: | |
# types: started | |
env: | |
REPO_URL: https://github.com/DHDAXCW/lede-rockchip | |
REPO_BRANCH: stable | |
CONFIG_FILE: configs/lede/full.config | |
DIY_SH: scripts/lede.sh | |
KMODS_IN_FIRMWARE: true | |
UPLOAD_RELEASE: true | |
TZ: Asia/Shanghai | |
jobs: | |
Build: | |
runs-on: self-hosted | |
outputs: | |
OPENWRTROOT: ${{ steps.update.outputs.OPENWRTROOT }} | |
PLATFORM: ${{ steps.compile.outputs.PLATFORM }} | |
TARGET: ${{ steps.compile.outputs.TARGET }} | |
SUBTARGET: ${{ steps.compile.outputs.SUBTARGET }} | |
FIRMWARE: ${{ steps.compile.outputs.FIRMWARE }} | |
GENERATE_STATUS: ${{ steps.generate.outputs.GENERATE_STATUS }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Initialization Environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
echo -e "Total CPU cores\t: $(nproc)" | |
cat /proc/cpuinfo | grep 'model name' | |
free -h | |
uname -a | |
[ -f /proc/version ] && cat /proc/version | |
[ -f /etc/issue.net ] && cat /etc/issue.net | |
[ -f /etc/issue ] && cat /etc/issue | |
ulimit -a | |
- name: Clone Source Code | |
run: | | |
df -hT $PWD | |
git clone $REPO_URL -b $REPO_BRANCH openwrt | |
cd openwrt | |
- name: Update Feeds | |
id: update | |
run: | | |
cd openwrt | |
echo "OPENWRTROOT=$PWD" >> $GITHUB_ENV | |
echo "OPENWRTROOT=$PWD" >> $GITHUB_OUTPUT | |
mkdir customfeeds | |
git clone --depth=1 https://github.com/DHDAXCW/packages customfeeds/packages | |
git clone --depth=1 https://github.com/DHDAXCW/luci customfeeds/luci | |
chmod +x ../scripts/*.sh | |
../scripts/hook-feeds.sh | |
- name: Install Feeds | |
run: | | |
cd $OPENWRTROOT | |
./scripts/feeds install -a | |
- name: Load Custom Configuration | |
run: | | |
[ -e files ] && mv files $OPENWRTROOT/files | |
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE $OPENWRTROOT/.config | |
chmod +x scripts/*.sh | |
cd $OPENWRTROOT | |
../$DIY_SH | |
../scripts/preset-clash-core.sh arm64 | |
../scripts/preset-terminal-tools.sh | |
echo ' | |
CONFIG_TARGET_ROOTFS_PARTSIZE=2048 | |
CONFIG_DOCKER_CGROUP_OPTIONS=y | |
CONFIG_DOCKER_NET_ENCRYPT=y | |
CONFIG_DOCKER_NET_MACVLAN=y | |
CONFIG_DOCKER_NET_OVERLAY=y | |
CONFIG_DOCKER_NET_TFTP=y | |
CONFIG_DOCKER_OPTIONAL_FEATURES=y | |
CONFIG_DOCKER_STO_BTRFS=y | |
CONFIG_DOCKER_STO_EXT4=y | |
CONFIG_PACKAGE_luci-app-dockerman=y | |
CONFIG_PACKAGE_luci-lib-docker=y | |
' >> .config | |
make defconfig | |
- name: Download Package | |
id: package | |
run: | | |
cd $OPENWRTROOT | |
cat .config | |
make download -j50 | |
make download -j8 | |
find dl -size -1024c -exec ls -l {} \; | |
find dl -size -1024c -exec rm -f {} \; | |
- name: Compile Packages | |
id: compile | |
run: | | |
cd $OPENWRTROOT | |
echo -e "$(nproc) thread compile" | |
make tools/compile -j$(nproc) || make tools/compile -j$(nproc) | |
make toolchain/compile -j$(nproc) || make toolchain/compile -j$(nproc) | |
make target/compile -j$(nproc) || make target/compile -j$(nproc) IGNORE_ERRORS=1 | |
make diffconfig | |
make package/compile -j$(nproc) IGNORE_ERRORS=1 || make package/compile -j$(nproc) IGNORE_ERRORS=1 | |
make package/index | |
cd $OPENWRTROOT/bin/packages/* | |
PLATFORM=$(basename `pwd`) | |
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV | |
echo "PLATFORM=$PLATFORM" >> $GITHUB_OUTPUT | |
cd $OPENWRTROOT/bin/targets/* | |
TARGET=$(basename `pwd`) | |
echo "TARGET=$TARGET" >> $GITHUB_ENV | |
echo "TARGET=$TARGET" >> $GITHUB_OUTPUT | |
cd * | |
SUBTARGET=$(basename `pwd`) | |
echo "SUBTARGET=$SUBTARGET" >> $GITHUB_ENV | |
echo "SUBTARGET=$SUBTARGET" >> $GITHUB_OUTPUT | |
echo "FIRMWARE=$PWD" >> $GITHUB_ENV | |
echo "FIRMWARE=$PWD" >> $GITHUB_OUTPUT | |
echo "COMPILE_STATUS=success" >> $GITHUB_OUTPUT | |
- name: Generate Firmware | |
if: steps.compile.outputs.COMPILE_STATUS == 'success' | |
id: generate | |
run: | | |
cd configs/opkg | |
sed -i "s/subtarget/$SUBTARGET/g" distfeeds*.conf | |
sed -i "s/target\//$TARGET\//g" distfeeds*.conf | |
sed -i "s/platform/$PLATFORM/g" distfeeds*.conf | |
cd $OPENWRTROOT | |
mkdir -p files/etc/uci-defaults/ | |
cp ../scripts/init-settings.sh files/etc/uci-defaults/99-init-settings | |
mkdir -p files/etc/opkg | |
cp ../configs/opkg/distfeeds-packages-server.conf files/etc/opkg/distfeeds.conf.server | |
mkdir -p files/etc/opkg/keys | |
cp ../configs/opkg/1035ac73cc4e59e3 files/etc/opkg/keys/1035ac73cc4e59e3 | |
if "$KMODS_IN_FIRMWARE" = 'true' | |
then | |
mkdir -p files/www/snapshots | |
cp -r bin/targets files/www/snapshots | |
cp ../configs/opkg/distfeeds-18.06-local.conf files/etc/opkg/distfeeds.conf | |
else | |
cp ../configs/opkg/distfeeds-18.06-remote.conf files/etc/opkg/distfeeds.conf | |
fi | |
cp files/etc/opkg/distfeeds.conf.server files/etc/opkg/distfeeds.conf.mirror | |
sed -i "s/http:\/\/192.168.123.100:2345\/snapshots/https:\/\/openwrt.cc\/snapshots\/$(date +"%Y-%m-%d")\/lean/g" files/etc/opkg/distfeeds.conf.mirror | |
make package/install -j$(nproc) || make package/install -j1 V=s | |
make target/install -j$(nproc) || make target/install -j1 V=s | |
pushd bin/targets/rockchip/armv8 | |
rm -rf *ext4* *.manifest packages *.json *.buildinfo | |
mv openwrt-rockchip-armv8-embedfire_doornet1-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-embedfire_doornet1-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-embedfire_doornet2-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-embedfire_doornet2-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-embedfire_lubancat-1n-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-embedfire_lubancat-1n-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-embedfire_lubancat-1-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-embedfire_lubancat-1-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-embedfire_lubancat-2n-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-embedfire_lubancat-2n-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-embedfire_lubancat-2-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-embedfire_lubancat-2-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-embedfire_lubancat-4-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-embedfire_lubancat-4-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-embedfire_lubancat-5-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-embedfire_lubancat-5-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-friendlyarm_nanopc-t6-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-friendlyarm_nanopc-t6-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-friendlyarm_nanopi-r2c-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-friendlyarm_nanopi-r2c-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-friendlyarm_nanopi-r2s-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-friendlyarm_nanopi-r2s-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-friendlyarm_nanopi-r4se-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-friendlyarm_nanopi-r4se-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-friendlyarm_nanopi-r4s-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-friendlyarm_nanopi-r4s-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-friendlyarm_nanopi-r5c-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-friendlyarm_nanopi-r5c-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-friendlyarm_nanopi-r5s-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-friendlyarm_nanopi-r5s-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-friendlyarm_nanopi-r6c-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-friendlyarm_nanopi-r6c-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-friendlyarm_nanopi-r6s-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-friendlyarm_nanopi-r6s-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-hinlink_h88k-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-hinlink_h88k-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-hinlink_opc-h66k-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-hinlink_opc-h66k-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-hinlink_opc-h68k-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-hinlink_opc-h68k-squashfs-sysupgrade.img.gz | |
mv openwrt-rockchip-armv8-hinlink_opc-h69k-squashfs-sysupgrade.img.gz $(date +"%Y.%m.%d")-docker-openwrt-hinlink_opc-h69k-squashfs-sysupgrade.img.gz | |
popd | |
make checksum | |
mv bin/targets/rockchip/armv8/sha256sums bin/targets/rockchip/armv8/docker-sha256sums | |
echo "GENERATE_STATUS=success" >> $GITHUB_OUTPUT | |
- name: Generate release tag | |
id: tag | |
if: env.UPLOAD_RELEASE == 'true' && !cancelled() | |
run: | | |
echo "release_tag=$(date +"%Y.%m.%d")-rockchip" >> $GITHUB_OUTPUT | |
echo "release_date=$(date +"%Y.%m.%d")" >> $GITHUB_OUTPUT | |
touch release.txt | |
echo "后台地址:192.168.11.1" >> release.txt | |
echo "status=success" >> $GITHUB_OUTPUT | |
- name: Upload firmware to release | |
uses: softprops/action-gh-release@master | |
if: steps.tag.outputs.status == 'success' && !cancelled() | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: ${{ steps.tag.outputs.release_date }} openwrt-rockchip-armv8-docker 下载固件 | |
tag_name: ${{ steps.tag.outputs.release_tag }} | |
body_path: release.txt | |
files: ${{ env.FIRMWARE }}/* | |
- name: Delete workflow runs | |
uses: Mattraks/delete-workflow-runs@v2 | |
with: | |
retain_days: 1 | |
keep_minimum_runs: 1 | |
- name: Remove old Releases | |
uses: dev-drprasad/delete-older-releases@v0.3.3 | |
if: env.UPLOAD_RELEASE == 'true' && !cancelled() | |
with: | |
keep_latest: 20 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Delete Artifacts | |
uses: geekyeggo/delete-artifact@v4 | |
with: | |
name: | | |
bin-archive |