forked from haiibo/OpenWrt
-
Notifications
You must be signed in to change notification settings - Fork 0
288 lines (261 loc) · 11.8 KB
/
ARMv8-Mini-OpenWrt.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
name: ARMv8 Mini OpenWrt
on:
workflow_dispatch:
schedule:
- cron: 0 20 * * *
env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master
CONFIG_FILE: configs/armv8-mini.config
DIY_SCRIPT: diy-mini.sh
CLASH_KERNEL: arm64
CACHE_TOOLCHAIN: true
UPLOAD_BIN_DIR: false
FIRMWARE_RELEASE: true
FIRMWARE_TAG: ROOTFS_MINI
OPENWRT_RELEASE: true
OPENWRT_TAG: ARMv8_MINI
TZ: Asia/Shanghai
jobs:
Build:
runs-on: ubuntu-22.04
outputs:
COMMIT_AUTHOR: ${{ steps.clone.outputs.COMMIT_AUTHOR }}
COMMIT_DATE: ${{ steps.clone.outputs.COMMIT_DATE }}
COMMIT_MESSAGE: ${{ steps.clone.outputs.COMMIT_MESSAGE }}
COMMIT_HASH: ${{ steps.clone.outputs.COMMIT_HASH }}
DEVICE_TARGET: ${{ steps.variable.outputs.DEVICE_TARGET }}
DEVICE_SUBTARGET: ${{ steps.variable.outputs.DEVICE_SUBTARGET }}
steps:
- name: Checkout
uses: actions/checkout@main
- name: Check Server Performance
run: |
echo "警告⚠"
echo "分配的服务器性能有限,若选择的插件过多,务必注意CPU性能!"
echo -e "已知CPU型号(降序): 7763,8370C,8272CL,8171M,E5-2673\n"
echo "--------------------------CPU信息--------------------------"
echo "CPU物理数量: $(cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l)"
echo "CPU核心数量: $(nproc)"
echo -e "CPU型号信息:$(cat /proc/cpuinfo | grep -m1 name | awk -F: '{print $2}')\n"
echo "--------------------------内存信息--------------------------"
echo "已安装内存详细信息:"
echo -e "$(sudo lshw -short -C memory | grep GiB)\n"
echo "--------------------------硬盘信息--------------------------"
echo "硬盘数量: $(ls /dev/sd* | grep -v [1-9] | wc -l)" && df -hT
- name: Initialization Environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
docker rmi $(docker images -q)
sudo rm -rf /usr/share/dotnet /etc/apt/sources.list.d /usr/local/lib/android $AGENT_TOOLSDIRECTORY
sudo -E apt-get -y purge azure-cli ghc* zulu* llvm* firefox google* dotnet* powershell openjdk* mongodb* moby* || true
sudo -E apt-get -y update
sudo -E apt-get -y install $(curl -fsSL is.gd/depends_ubuntu_2204)
sudo -E systemctl daemon-reload
sudo -E apt-get -y autoremove --purge
sudo -E apt-get -y clean
sudo timedatectl set-timezone "$TZ"
- name: Clone Source Code
id: clone
run: |
df -hT $GITHUB_WORKSPACE
git clone $REPO_URL -b $REPO_BRANCH openwrt
cd openwrt
echo "OPENWRT_PATH=$PWD" >> $GITHUB_ENV
COMMIT_AUTHOR=$(git show -s --date=short --format="作者: %an")
echo "COMMIT_AUTHOR=$COMMIT_AUTHOR" >> $GITHUB_ENV
echo "COMMIT_AUTHOR=$COMMIT_AUTHOR" >> $GITHUB_OUTPUT
COMMIT_DATE=$(git show -s --date=short --format="时间: %ci")
echo "COMMIT_DATE=$COMMIT_DATE" >> $GITHUB_ENV
echo "COMMIT_DATE=$COMMIT_DATE" >> $GITHUB_OUTPUT
COMMIT_MESSAGE=$(git show -s --date=short --format="内容: %s")
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_ENV
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT
COMMIT_HASH=$(git show -s --date=short --format="hash: %H")
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_ENV
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_OUTPUT
- name: Generate Variables
id: variable
run: |
cp $CONFIG_FILE $OPENWRT_PATH/.config
cd $OPENWRT_PATH
make defconfig > /dev/null 2>&1
SOURCE_REPO="$(echo $REPO_URL | awk -F '/' '{print $(NF)}')"
echo "SOURCE_REPO=$SOURCE_REPO" >> $GITHUB_ENV
DEVICE_TARGET=$(cat .config | grep CONFIG_TARGET_BOARD | awk -F '"' '{print $2}')
echo "DEVICE_TARGET=$DEVICE_TARGET" >> $GITHUB_ENV
echo "DEVICE_TARGET=$DEVICE_TARGET" >> $GITHUB_OUTPUT
DEVICE_SUBTARGET=$(cat .config | grep CONFIG_TARGET_SUBTARGET | awk -F '"' '{print $2}')
echo "DEVICE_SUBTARGET=$DEVICE_SUBTARGET" >> $GITHUB_ENV
echo "DEVICE_SUBTARGET=$DEVICE_SUBTARGET" >> $GITHUB_OUTPUT
- name: Cache Toolchain
if: env.CACHE_TOOLCHAIN == 'true'
uses: HiGarfield/cachewrtbuild@main
with:
ccache: false
mixkey: ${{ env.SOURCE_REPO }}-${{ env.REPO_BRANCH }}-${{ env.DEVICE_TARGET }}-${{ env.DEVICE_SUBTARGET }}
prefix: ${{ env.OPENWRT_PATH }}
- name: Install Feeds
run: |
cd $OPENWRT_PATH
./scripts/feeds update -a
./scripts/feeds install -a
- name: Load Custom Configuration
run: |
[ -e files ] && mv files $OPENWRT_PATH/files
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE $OPENWRT_PATH/.config
chmod +x $GITHUB_WORKSPACE/scripts/*.sh
chmod +x $DIY_SCRIPT
cd $OPENWRT_PATH
$GITHUB_WORKSPACE/$DIY_SCRIPT
$GITHUB_WORKSPACE/scripts/preset-clash-core.sh $CLASH_KERNEL
$GITHUB_WORKSPACE/scripts/preset-terminal-tools.sh
- name: Download DL Package
run: |
cd $OPENWRT_PATH
make defconfig
make download -j8
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
- name: Compile Firmware
id: compile
run: |
cd $OPENWRT_PATH
mkdir -p files/etc/uci-defaults
cp $GITHUB_WORKSPACE/scripts/init-settings.sh files/etc/uci-defaults/99-init-settings
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 || make -j1 V=s
echo "status=success" >> $GITHUB_OUTPUT
echo "DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
echo "FILE_DATE=$(date +"%Y.%m.%d")" >> $GITHUB_ENV
- name: Check Space Usage
if: (!cancelled())
run: df -hT
- name: Upload Bin Directory
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true'
uses: actions/upload-artifact@main
with:
name: ${{ env.SOURCE_REPO }}-bin-${{ env.DEVICE_TARGET }}-${{ env.DEVICE_SUBTARGET }}-${{ env.FILE_DATE }}
path: ${{ env.OPENWRT_PATH }}/bin
- name: Organize Files
if: steps.compile.outputs.status == 'success'
run: |
cd $OPENWRT_PATH/bin/targets/*/*
cat sha256sums
cp $OPENWRT_PATH/.config build.config
mv -f $OPENWRT_PATH/bin/packages/*/*/*.ipk packages
tar -zcf Packages.tar.gz packages
rm -rf packages feeds.buildinfo version.buildinfo
echo "FIRMWARE_PATH=$PWD" >> $GITHUB_ENV
- name: Upload Firmware To Artifact
if: steps.compile.outputs.status == 'success' && env.FIRMWARE_RELEASE != 'true'
uses: actions/upload-artifact@main
with:
name: ${{ env.SOURCE_REPO }}-firmware-${{ env.DEVICE_TARGET }}-${{ env.DEVICE_SUBTARGET }}-${{ env.FILE_DATE }}
path: ${{ env.FIRMWARE_PATH }}
- name: Upload Firmware To Release
if: steps.compile.outputs.status == 'success' && env.FIRMWARE_RELEASE == 'true'
uses: ncipollo/release-action@v1
with:
name: R${{ env.DATE }} for ${{ env.FIRMWARE_TAG }}
allowUpdates: true
tag: ${{ env.FIRMWARE_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: ${{ env.FIRMWARE_PATH }}/*
body: |
**This is Temporary Firmware for Armvirt 64**
### 📒 固件信息
- 🚀 成品固件点击此处跳转➦[MINI](https://github.com/haiibo/OpenWrt/releases/tag/ARMv8_MINI)即可下载
- 💻 平台架构: ${{ env.DEVICE_TARGET }}-${{ env.DEVICE_SUBTARGET }} (精简版临时固件)
- ⚽ 固件源码: ${{ env.REPO_URL }}
- 💝 源码分支: ${{ env.REPO_BRANCH }}
- 🌐 默认地址: 192.168.1.1
- 🔑 默认密码: password
### 🧊 固件版本
- 固件编译前最后一次➦[主源码](${{ env.REPO_URL }})更新记录
- ${{ env.COMMIT_AUTHOR }}
- ${{ env.COMMIT_DATE }}
- ${{ env.COMMIT_MESSAGE }}
- ${{ env.COMMIT_HASH }}
Package:
needs: [Build]
runs-on: ubuntu-22.04
env:
COMMIT_AUTHOR: ${{ needs.Build.outputs.COMMIT_AUTHOR }}
COMMIT_DATE: ${{ needs.Build.outputs.COMMIT_DATE }}
COMMIT_MESSAGE: ${{ needs.Build.outputs.COMMIT_MESSAGE }}
COMMIT_HASH: ${{ needs.Build.outputs.COMMIT_HASH }}
DEVICE_TARGET: ${{ needs.Build.outputs.DEVICE_TARGET }}
DEVICE_SUBTARGET: ${{ needs.Build.outputs.DEVICE_SUBTARGET }}
steps:
- name: Checkout
uses: actions/checkout@main
- name: Initialization Environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
docker rmi $(docker images -q)
sudo rm -rf /usr/share/dotnet /etc/apt/sources.list.d /usr/local/lib/android $AGENT_TOOLSDIRECTORY
sudo -E apt-get -y update
sudo -E apt-get -y install $(curl -fsSL is.gd/depends_ubuntu_2204)
sudo -E apt-get -y autoremove --purge
sudo -E apt-get -y clean
sudo timedatectl set-timezone "$TZ"
- name: Download Armvirt Firmware
id: download
run: |
FIRMWARE_PATH=openwrt/bin/targets/armvirt/64
[ -d $FIRMWARE_PATH ] || mkdir -p $FIRMWARE_PATH
cd $FIRMWARE_PATH
wget -q $(curl -s "https://api.github.com/repos/$GITHUB_REPOSITORY/releases" | grep "$FIRMWARE_TAG.*rootfs.tar.gz" | awk -F '"' '{print $4}')
echo "status=success" >> $GITHUB_OUTPUT
echo "DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
echo "DATE1=$(date +"%y.%m.%d")" >> $GITHUB_ENV
- name: Package OpenWrt Firmware
if: steps.download.outputs.status == 'success'
uses: ophub/flippy-openwrt-actions@main
env:
OPENWRT_ARMVIRT: openwrt/bin/targets/*/*/*rootfs.tar.gz
PACKAGE_SOC: all
WHOAMI: Haiibo
KERNEL_VERSION_NAME: 5.15.13_6.1.5
KERNEL_AUTO_LATEST: true
DISTRIB_REVISION: R${{ env.DATE1 }} by Haiibo
- name: Upload OpenWrt To Artifact
if: env.PACKAGED_STATUS == 'success' && env.OPENWRT_RELEASE != 'true'
uses: kittaakos/upload-artifact-as-is@master
with:
path: ${{ env.PACKAGED_OUTPUTPATH }}
- name: Upload OpenWrt To Release
if: env.PACKAGED_STATUS == 'success' && env.OPENWRT_RELEASE == 'true'
uses: ncipollo/release-action@v1
with:
name: R${{ env.DATE }} for ${{ env.OPENWRT_TAG }}
allowUpdates: true
removeArtifacts: true
tag: ${{ env.OPENWRT_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: ${{ env.PACKAGED_OUTPUTPATH }}/*
body: |
**This is OpenWrt Firmware for Armvirt 64**
### 📒 固件信息
- 🚀 ARMv8 精简版,主打科学上网适合养老
- 💻 平台架构: ${{ env.DEVICE_TARGET }}-${{ env.DEVICE_SUBTARGET }}
- ⚽ 固件源码: ${{ env.REPO_URL }}
- 💝 源码分支: ${{ env.REPO_BRANCH }}
- 🌐 默认地址: 192.168.1.1
- 🔑 默认密码: password
### 🍻 安装与更新
- 用插件安装: 系统 → 晶晨宝盒 → 安装 OpenWrt → 选择型号 → 安装
- 用命令安装: U盘启动成功后输入命令 `openwrt-install-amlogic` 按照英文提示写入到 emmc
- 用插件更新: 系统 → 晶晨宝盒 → 在线下载更新 → 完整更新全系统
- 用命令更新: 上传固件到 `/mnt/mmcblk2p4` 目录,输入命令 `openwrt-update-amlogic` 即可更新
- 注意: 如非 `amlogic` 平台,请将其更改为对应平台 `rockchip` `allwinner`
- 部分常见问题及注意事项请参考恩山论坛F大➦[最新帖](https://www.right.com.cn/forum/thread-4076037-1-1.html)
### 🧊 固件版本
- 固件编译前最后一次➦[主源码](${{ env.REPO_URL }})更新记录
- ${{ env.COMMIT_AUTHOR }}
- ${{ env.COMMIT_DATE }}
- ${{ env.COMMIT_MESSAGE }}
- ${{ env.COMMIT_HASH }}