openwrtN1 #8
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
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 | |
CONFIG_FILE: .config | |
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: | | |
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
sudo -E apt-get -qq update | |
sudo -E apt-get -qq install $(curl -fsSL git.io/depends-ubuntu-2004) | |
sudo -E apt-get -qq autoremove --purge | |
sudo -E apt-get -qq 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 | |
echo "::set-output name=status::success" | |
- 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: Create release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: OpenWrt_s905d_${{ env.PACKAGED_OUTPUTDATE }} | |
name: N1-OpenWrt | ${{ env.DATE }} | |
allowUpdates: true | |
artifacts: ${{ 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: 10 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASES_TOKEN }} | |
- name: Delete older workflow runs and artifacts | |
uses: Mattraks/delete-workflow-runs@v2 | |
if: env.DELETE_ARTIFACTS == 'true' | |
with: | |
token: ${{ secrets.RELEASES_TOKEN }} | |
repository: ${{ github.repository }} | |
retain_days: 30 | |
keep_minimum_runs: 6 |