-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (118 loc) · 4.13 KB
/
OpenWrt-x86-64-Lean-Tiny-OP.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#
# <https://github.com/KFERMercer/OpenWrt-CI>
#
# Copyright (C) 2019 P3TERX
#
# Copyright (C) 2020 KFERMercer
#
name: OpenWrt-x86-64-Lean-Tiny-OP
on:
# 定时触发(每天早4点10分)
schedule:
- cron: 10 20 * * *
# release触发
release:
types: [published]
# 点赞触发
watch:
types: [started]
# 编辑触发
# push:
# branches:
# - master
# config触发
# paths:
# - 'Tiny-OP.sh'
env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master
DIY_SH: Tiny-OP.sh
TZ: Asia/Shanghai
jobs:
build_openwrt:
name: 编译OpenWrt固件
if: github.event.repository.owner.id == github.event.sender.id
runs-on: ubuntu-latest
steps:
- name: 校验本地文件
uses: actions/checkout@v2
with:
ref: master
- name: 初始化编译环境
env:
DEBIAN_FRONTEND: noninteractive
run: |
docker rmi `docker images -q`
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d
sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php* android*
sudo -E apt-get update
sudo -E apt-get -qq install -y 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 gcc-multilib g++-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler ccache xsltproc rename antlr3 gperf wget curl swig rsync libtinfo5
sudo -E apt-get -y autoremove --purge
sudo -E apt-get clean
df -h
- name: 克隆源代码
run: |
git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt
- name: 更新时区、编译时间
id: date
run: |
sudo timedatectl set-timezone "$TZ"
echo "::set-output name=status::success"
echo "FILE_DATE=$(date +"%m-%d %H.%M")" >> $GITHUB_ENV
- name: 更新源并创建配置文件
run: |
[ -e files ] && mv files openwrt/files
chmod +x $DIY_SH
cd openwrt
../$DIY_SH
make defconfig
- name: 下载软件包
run: |
cd openwrt && make download -j8
find dl -size -1024c -exec rm -f {} \;
- name: 编译固件
run: |
cd openwrt
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 || make -j1 V=s
- name: 检查空间使用情况
run: |
echo "======================="
echo "Space usage:"
echo "======================="
df -hT
echo "======================="
du -h --max-depth=1 openwrt/ --exclude=build_dir --exclude=bin
du -h --max-depth=1 openwrt/build_dir
du -h --max-depth=1 openwrt/bin
- name: 整理文件
run: |
mkdir -p ./artifact/firmware
mkdir -p ./artifact/vmware
mkdir -p ./artifact/package
mkdir -p ./artifact/buildinfo
rm -rf $(find openwrt/bin/targets/ -type d -name "packages")
cp -rf $(find openwrt/bin/packages/ -type f -name "*.ipk") ./artifact/package/
cp -rf $(find openwrt/bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/
cp -rf $(find openwrt/bin/targets/ -type f -name "*combined*img*") ./artifact/firmware/
cp -rf $(find openwrt/bin/targets/ -type f -name "*combined*vmdk*") ./artifact/vmware/
- name: 上传固件
uses: actions/upload-artifact@v2
with:
name: OpenWrt-firmware-Lean-${{ env.FILE_DATE }}
path: ./artifact/firmware/
- name: 上传vmware镜像
uses: actions/upload-artifact@v2
with:
name: OpenWrt-vmware-Lean-${{ env.FILE_DATE }}
path: ./artifact/vmware/
- name: 上传插件包
uses: actions/upload-artifact@v2
with:
name: OpenWrt-package-Lean-${{ env.FILE_DATE }}
path: ./artifact/package/
- name: 上传固件信息
uses: actions/upload-artifact@v2
with:
name: OpenWrt-buildinfo-Lean-${{ env.FILE_DATE }}
path: ./artifact/buildinfo/