-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (104 loc) · 3.93 KB
/
build-openwrt-Lienol.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#=================================================
# https://github.com/P3TERX/Actions-OpenWrt
# Description: Build OpenWrt using GitHub Actions
# Lisence: MIT
# Author: P3TERX
# Blog: https://p3terx.com
#=================================================
name: OpenWrt-x86-Lienol
on:
# release:
# types: published
# push:
# branches:
# - master
# paths:
# - 'Lienol'
# schedule:
# - cron: 0 20 * * *
# watch:
# types: started
env:
REPO_URL: https://github.com/Lienol/openwrt
REPO_BRANCH: 21.02
CONFIG_FILE: config-x86-Lienol
DIY_SH: diy-x86-Lienol.sh
SSH_ACTIONS: false
UPLOAD_BIN_DIR: true
UPLOAD_FIRMWARE: true
TZ: Asia/Shanghai
jobs:
build:
runs-on: ubuntu-18.04
if: github.event.repository.owner.id == github.event.sender.id
steps:
- name: Checkout
uses: actions/checkout@master
- name: 初始环境
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 build-essential asciidoc binutils bzip2 curl gawk gettext git libncurses5-dev libz-dev patch python3.5 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
sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
- name: 下载源码
run: git clone -b $REPO_BRANCH --single-branch $REPO_URL openwrt && cd openwrt && ./scripts/feeds clean && ./scripts/feeds update -a && ./scripts/feeds install -a
- name: 导入自定义
run: |
git clone https://github.com/sypopo/diy ./openwrt/diy/sypopo
mv ./openwrt/diy/sypopo/$CONFIG_FILE $(pwd)
mv ./openwrt/diy/sypopo/$DIY_SH $(pwd)
df -h && pwd
[ -e files ] && mv files openwrt/files
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config
chmod +x $DIY_SH && cd openwrt && ../$DIY_SH
- name: SSH连接
uses: sypopo/debugger-action@master
if: env.SSH_ACTIONS == 'true'
- name: 下载软件包
id: package
run: |
cd openwrt && make defconfig && make download -j8
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
- name: 固件编译
id: compile
run: |
cd openwrt
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 V=s
echo "::set-output name=status::success"
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
cp -f .config ./bin/targets/*/*/
- name: 上传bin
uses: actions/upload-artifact@master
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true'
with:
name: OpenWrt_bin-x86-Lienol
path: openwrt/bin
- name: 固件打包
id: organize
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled()
run: |
cp openwrt/.config openwrt/bin/targets/x86/64/config.txt
tar -czf bin.tar.gz openwrt/bin && cp -vf bin.tar.gz openwrt/bin/targets/x86/64
cd openwrt/bin/targets/*/*
rm -rf packages *rootfs* *vmlinuz *info *fest
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "::set-output name=status::success"
- name: 上传固件
uses: actions/upload-artifact@master
if: steps.organize.outputs.status == 'success' && !cancelled()
with:
name: OpenWrt-x86-Lienol
path: ${{ env.FIRMWARE }}