X-OpenWrt/.github/workflows/AutoBuild.yml

102 lines
2.9 KiB
YAML
Raw Normal View History

2020-09-08 03:23:08 +00:00
#=================================================
# Description: Build OpenWrt using GitHub Actions
2020-09-11 01:37:13 +00:00
# Github: https://github.com/Hyy2001X/AutoBuild-Actions
2020-09-08 03:23:08 +00:00
# Lisence: MIT
2020-09-11 01:34:26 +00:00
# Author: P3TERX
2020-09-08 03:23:08 +00:00
# Modify: Hyy2001
#=================================================
2020-09-11 01:34:26 +00:00
name: AutoBuild OpenWrt
2020-09-08 03:23:08 +00:00
on:
2020-09-11 01:34:26 +00:00
# release:
# types: [published]
2020-09-08 03:23:08 +00:00
2020-09-11 01:34:26 +00:00
# push:
# branches:
# - main
2020-09-08 03:23:08 +00:00
2020-09-11 01:34:26 +00:00
# schedule:
# - cron: 0 8 * * 5
2020-09-08 03:23:08 +00:00
watch:
types: [started]
env:
REPO_URL: https://github.com/coolsnowwolf/lede
2020-09-11 01:34:26 +00:00
REPO_BRANCH: main
2020-09-08 03:23:08 +00:00
CONFIG_FILE: .config
2020-09-11 01:34:26 +00:00
FEEDS_CONF_DEFAULT: feeds.conf.default
MAC80211: mac80211.sh
MWAN3: mwan3
CUSTOM_SCRIPT_1: diy-part1.sh
CUSTOM_SCRIPT_2: diy-part2.sh
CUSTOM_SCRIPT_3: diy-part3.sh
TZ: Asia/Shanghai
2020-09-08 03:23:08 +00:00
jobs:
build:
2020-09-11 01:34:26 +00:00
runs-on: ubuntu-18.04
2020-09-08 03:23:08 +00:00
steps:
- name: Checkout
2020-09-11 01:34:26 +00:00
uses: actions/checkout@main
2020-09-08 03:23:08 +00:00
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
2020-09-11 01:34:26 +00:00
sudo -E apt-get update
sudo -E apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget swig rsync
2020-09-08 03:23:08 +00:00
2020-09-11 01:34:26 +00:00
- name: Clone OpenWRT source code
2020-09-08 03:23:08 +00:00
run: |
2020-09-11 01:34:26 +00:00
git clone -b $REPO_BRANCH $REPO_URL openwrt
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
2020-09-11 01:37:13 +00:00
2020-09-11 01:34:26 +00:00
- name: Run Before-Update-Feeds Script
run: |
[ -e $FEEDS_CONF_DEFAULT ] && mv $FEEDS_CONF_DEFAULT openwrt/feeds.conf.default
chmod +x $CUSTOM_SCRIPT_1
cd openwrt
$GITHUB_WORKSPACE/$CUSTOM_SCRIPT_1
2020-09-11 01:37:13 +00:00
2020-09-11 01:34:26 +00:00
- name: Update & Install Feeds
2020-09-08 03:23:08 +00:00
run: |
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
2020-09-11 01:34:26 +00:00
- name: Run After-Update-Feeds Script
2020-09-08 03:23:08 +00:00
run: |
2020-09-11 01:34:26 +00:00
[ -e $MAC80211 ] && mv $MAC80211 openwrt/package/kernel/mac80211/files/lib/wifi/mac80211.sh
[ -e $MWAN3 ] && mv $MWAN3 openwrt/package/feeds/packages/mwan3/files/etc/config/mwan3
2020-09-08 03:23:08 +00:00
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config
2020-09-11 01:34:26 +00:00
chmod +x $CUSTOM_SCRIPT_2
2020-09-08 03:23:08 +00:00
cd openwrt
2020-09-11 01:34:26 +00:00
$GITHUB_WORKSPACE/$CUSTOM_SCRIPT_2
2020-09-11 01:37:13 +00:00
2020-09-08 03:23:08 +00:00
- name: Download package
run: |
cd openwrt
2020-09-11 01:34:26 +00:00
make download -j$(nproc)
2020-09-08 03:23:08 +00:00
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
2020-09-11 01:34:26 +00:00
- name: Compile the firmware
2020-09-08 03:23:08 +00:00
run: |
2020-09-11 01:34:26 +00:00
cd openwrt
2020-09-08 03:23:08 +00:00
make -j$(nproc) V=s
2020-09-11 01:34:26 +00:00
- name: Run After-Compile-OpenWRT Script
run: |
chmod +x $CUSTOM_SCRIPT_3
cd openwrt
$GITHUB_WORKSPACE/$CUSTOM_SCRIPT_3
- name : Upload Firmware to Artifact
uses: actions/upload-artifact@main
2020-09-08 03:23:08 +00:00
with:
name: OpenWrt
2020-09-11 01:34:26 +00:00
path: openwrt/bin/Firmware