Skip to content

openwrtN1

openwrtN1 #32

Workflow file for this run

name: openwrtN1
on:
repository_dispatch:
workflow_dispatch:
inputs:
ssh:
description: 'SSH connection to Actions'
required: false
default: 'false'
schedule:
- cron: 0 0 * * 5
env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master
FEEDS_CONF: feeds.conf.default
SCRIPT_SH: script.sh
CONFIG_SH: config.sh
UPLOAD_FIRMWARE: true
TZ: Asia/Shanghai
jobs:
build_openwrt:
name: Build OpenWrt and release
runs-on: ubuntu-20.04
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: main
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
docker rmi `docker images -q`
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc /etc/mysql /etc/php
sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php*
sudo -E apt update -y
sudo -E apt full-upgrade -y
sudo -E apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
sudo -E apt-get -y autoremove --purge
sudo -E apt-get clean
sudo timedatectl set-timezone "$TZ"
df -h
- name: Clone source code
run: |
git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt
cd openwrt
useVersionInfo=$(git show -s --date=short --format="date: %cd<br/>commit: %s<br/>commit hash: %H")
echo "useVersionInfo=$useVersionInfo" >> $GITHUB_ENV
echo "DATE=$(date "+%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
echo "tag_name=$(date +%Y%m%d)" >> $GITHUB_ENV
#- name: Load custom feeds
# run: |
# [ -e files ] && mv files openwrt/files
- name: Update feeds
run: cd openwrt && ./scripts/feeds update -a
- name: Install feeds
run: |
chmod +x $SCRIPT_SH
./$SCRIPT_SH
cd openwrt && ./scripts/feeds install -a
- name: Load custom configuration
run: |
chmod +x $CONFIG_SH
./$CONFIG_SH
- name: Download package
run: |
cd openwrt
make defconfig
make download -j8
find dl -size -1024c -exec rm -f {} \;
- name: Compile the firmware
run: |
cd openwrt
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 V=s
echo "======================="
echo "Space usage:"
echo "======================="
df -h
echo "======================="
du -h --max-depth=1 ./ --exclude=build_dir --exclude=bin
du -h --max-depth=1 ./build_dir
du -h --max-depth=1 ./bin
rm -rf ./build_dir
echo "status=success" >> $GITHUB_OUTPUT
- name: Package Armvirt as OpenWrt
uses: ophub/flippy-openwrt-actions@main
env:
OPENWRT_ARMVIRT: openwrt/bin/targets/*/*/*.tar.gz
PACKAGE_SOC: s905d
KERNEL_VERSION_NAME: 5.15.121_6.1.40
KERNEL_AUTO_LATEST: true
WHOAMI: CHH
GH_TOKEN: ${{ secrets.RELEASES_TOKEN }}
- name: Organize files
id: organize
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled()
run: |
cd openwrt/bin/targets/*/*
rm -rf packages openwrt-armvirt-64-default.manifest openwrt-armvirt-64-Image sha256sums version.buildinfo feeds.buildinfo openwrt-armvirt-64-generic-kernel.bin openwrt-armvirt-64-generic.manifest
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "status=success" >> $GITHUB_OUTPUT
- name: Upload firmware directory
uses: actions/upload-artifact@v3
if: steps.organize.outputs.status == 'success' && !cancelled()
with:
name: OpenWrt_firmware
path: |
${{ env.FIRMWARE }}
${{ env.PACKAGED_OUTPUTPATH }}
- name: Create release
uses: ncipollo/release-action@v1
with:
tag: OpenWrt_s905d_${{ env.PACKAGED_OUTPUTDATE }}
name: N1-OpenWrt | ${{ env.DATE }}
allowUpdates: true
artifacts: "${{ env.FIRMWARE }}/*.*,${{ env.PACKAGED_OUTPUTPATH }}/*.*"
token: ${{ secrets.RELEASES_TOKEN }}
body: |
N1 OpenWrt Argon
* IP:10.0.0.1
默认用户名:root
默认密码:password
安装到EMMC及在线更新:系统-->晶晨宝盒
- name: Remove old Releases
uses: dev-drprasad/delete-older-releases@v0.2.1
with:
keep_latest: 5
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.RELEASES_TOKEN }}