-
Notifications
You must be signed in to change notification settings - Fork 0
355 lines (318 loc) · 14.5 KB
/
n1_istore_24.04.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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
#
# Copyright (c) 2019-2020 P3TERX <https://p3terx.com>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
# https://github.com/P3TERX/Actions-OpenWrt
# Description: Build OpenWrt using GitHub Actions
#
name: N1_istore_24.04
on:
repository_dispatch:
workflow_dispatch:
# inputs:
# ssh:
# description: 'SSH connection to Actions'
# required: false
# default: 'false'
# schedule:
# - cron: 10 16 * * *
env:
REPO_URL: https://github.com/immortalwrt/immortalwrt
REPO_BRANCH: master
FEEDS_CONF: feeds.conf.default
# CONFIG_FILE: N1_basic.config
CONFIG_FILE: N1_medium_istore.config
# CONFIG_FILE: N1_medium.config
DIY_P1_SH: diy-part1.sh
DIY_P2_SH: diy-part2.sh
UPLOAD_BIN_DIR: false
UPLOAD_FIRMWARE: false
UPLOAD_RELEASE: true
TZ: Asia/Shanghai
OPENWRT_TAG: armsr
OPENWRT_RELEASE: true
ROOTFS_RELEASE: true
ROOTFS_TAG: ROOTFS_24.04
jobs:
Build:
runs-on: ubuntu-24.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: Check server configuration
run: |
echo "警告⚠"
echo "若分配的服务器性能不足,务必及时取消,重新运行!"
echo "已知CPU型号(降序):7763,8370C,8272CL,8171M,E5-2673"
echo "已知性能不足CPU型号:8272CL"
echo -e "-------------- ------------CPU信息------------------------------------------\n"
echo "CPU物理数量:$(cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l)"
echo -e "CPU核心及版本信息:$(cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c) \n"
echo "-------------------------------内存信息-------------------------------------------"
echo "已安装内存详细信息:"
sudo lshw -short -C memory | grep GiB
echo -e "\n"
echo "-----------------------------硬盘信息---------------------------------------------"
echo -e "硬盘数量:$(ls /dev/sd* | grep -v [1-9] | wc -l) \n"
echo "硬盘详情:"
df -Th
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
sudo -E apt-get -qq update
sudo apt-get -qq install ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
bzip2 ccache clang cmake cpio curl device-tree-compiler ecj fastjar flex gawk gettext gcc-multilib \
g++-multilib git gnutls-dev gperf haveged help2man intltool lib32gcc-s1 libc6-dev-i386 libelf-dev \
libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libpython3-dev libreadline-dev \
libncursesw5-dev libpython3-dev libreadline-dev libssl-dev libtool lld llvm lrzsz mkisofs msmtp \
nano ninja-build p7zip p7zip-full patch pkgconf python3 python3-pip python3-ply \
python3-docutils python3-pyelftools qemu-utils re2c rsync scons squashfs-tools subversion swig \
texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev zstd texlive-full lldb clangd
sudo -E apt-get -qq install libfuse-dev
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo timedatectl set-timezone "$TZ"
- name: Combine Disks
uses: easimon/maximize-build-space@master
with:
swap-size-mb: 1024
temp-reserve-mb: 100
root-reserve-mb: 1024
- name: Checkout
uses: actions/checkout@main
- 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
Emoji=("🎉" "🤞" "✨" "🎁" "🎈" "🎄" "🎨" "💋" "🍓" "🍕" "🍉" "💐" "🌴" "🚀" "🛸" "🗽" "⛅" "🌈" "🔥" "⛄" "🐶" "🏅" "🦄" "🐤")
echo "EMOJI=${Emoji[$[$RANDOM % ${#Emoji[@]}]]}" >> $GITHUB_ENV
- name: Load custom feeds
run: |
[ -e $FEEDS_CONF ] && mv $FEEDS_CONF $OPENWRT_PATH/feeds.conf.default
chmod +x $DIY_P1_SH
cd $OPENWRT_PATH
$GITHUB_WORKSPACE/$DIY_P1_SH
- name: Update feeds
run: cd $OPENWRT_PATH && ./scripts/feeds update -a
- name: Install feeds
run: cd $OPENWRT_PATH && ./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 $DIY_P2_SH
cd $OPENWRT_PATH
$GITHUB_WORKSPACE/$DIY_P2_SH
- name: Get architecture
working-directory: ${{ github.workspace }}/openwrt
run: |
TARGET_DEVICE_ARCH="$(grep "^CONFIG_TARGET_.*=y$" ".config" | head -n 1 | sed 's/^CONFIG_TARGET_//g' | sed 's/=y//g'| awk -F '_' '{print $1}')"
echo "TARGET_DEVICE_ARCH=${TARGET_DEVICE_ARCH}" >>$GITHUB_ENV
- name: cache
uses: klever1988/cachewrtbuild@main
with:
ccache: 'true'
mixkey: ${{ env.TARGET_DEVICE_ARCH }}
toolchain: 'true'
prefix: ${{ github.workspace }}/openwrt
#- name: SSH connection to Actions
# uses: P3TERX/[email protected]
# if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh')
# env:
# TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
# TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
- name: Download package
id: package
run: |
cd $OPENWRT_PATH
echo -e 'CONFIG_DEVEL=y\nCONFIG_CCACHE=y' >> .config; make defconfig
make download -j8
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
# rm -rf $GITHUB_WORKSPACE/.git
# rm -rf $GITHUB_WORKSPACE/opt
df -Th
- name: Compile the firmware
id: compile
run: |
cd $OPENWRT_PATH
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 || make -j1 V=s
echo "status=success" >> ${GITHUB_OUTPUT}
grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' > DEVICE_NAME
[ -s DEVICE_NAME ] && echo "DEVICE_NAME=_$(cat DEVICE_NAME)" >> $GITHUB_ENV
echo "FILE_DATE=$(date +"%Y-%m-%d_%H:%M")" >> $GITHUB_ENV
- name: Clean up server space & Check space usage
if: steps.compile.outputs.status == 'success' && !cancelled()
run: |
cd $OPENWRT_PATH/
# rm -rf $(ls . | grep -v "^bin$" | xargs) 2>/dev/null
df -hT ${PWD}
- name: Upload bin directory
uses: actions/upload-artifact@main
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true'
with:
name: OpenWrt_bin${{ env.DEVICE_NAME }}${{ env.FILE_DATE }}
path: $OPENWRT_PATH/bin
# retention-days: 3 # <= 这里可以设置保留天数
- name: Organize files
id: organize
if: steps.compile.outputs.status == 'success' && !cancelled()
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 directory
# uses: actions/upload-artifact@main
# if: env.UPLOAD_FIRMWARE == 'true' && steps.organize.outputs.status == 'success' && !cancelled()
# with:
# name: OpenWrt_firmware${{ env.DEVICE_NAME }}${{ env.FILE_DATE }}
# path: ${{ env.FIRMWARE }}
# retention-days: 3 # <= 这里可以设置保留天数
- name: Upload ROOTFS_dibao To Release
if: steps.compile.outputs.status == 'success' && env.ROOTFS_RELEASE == 'true'
uses: ncipollo/[email protected]
with:
name: ${{ env.DATE }} for ${{ env.ROOTFS_TAG }} ${{ env.EMOJI }}
allowUpdates: true
tag: ${{ env.ROOTFS_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: ${{ env.FIRMWARE_PATH }}/*
body: |
**This is Temporary Firmware for Armvirt 64, can't be installed directly**
** with istore **
### 📒 固件信息
- 🚀 成品固件点击此处跳转➦[PLUS](https://github.com/xuexijiaoben/My_immortalwrt/releases/tag/armsr)即可下载
- 💻 平台架构: ${{ env.DEVICE_TARGET }}-${{ env.DEVICE_SUBTARGET }} (多功能临时底包)
- ⚽ 固件源码: ${{ env.REPO_URL }}
- 💝 源码分支: ${{ env.REPO_BRANCH }}
- 🌐 默认地址: 192.168.2.3
- 🔑 默认密码: password
Package:
needs: [Build]
runs-on: ubuntu-24.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: |
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo timedatectl set-timezone "$TZ"
Emoji=("🎉" "🤞" "✨" "🎁" "🎈" "🎄" "🎨" "💋" "🍓" "🍕" "🍉" "💐" "🌴" "🚀" "🛸" "🗽" "⛅" "🌈" "🔥" "⛄" "🐶" "🏅" "🦄" "🐤")
echo "EMOJI=${Emoji[$[$RANDOM % ${#Emoji[@]}]]}" >> $GITHUB_ENV
- 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 "$ROOTFS_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 immortalwrt Firmware
if: steps.download.outputs.status == 'success'
uses: unifreq/openwrt_packit@master
env:
OPENWRT_ARMVIRT: openwrt/bin/targets/*/*/immortalwrt-armsr-armv8-generic-rootfs.tar.gz
KERNEL_REPO_URL: breakings/OpenWrt
KERNEL_VERSION_NAME: 5.15.164_6.1.106
KERNEL_AUTO_LATEST: true
PACKAGE_SOC: s905d
SCRIPT_S905D: mk_s905d_n1.sh
WHOAMI: huoleifeng
DISTRIB_REVISION: R${{ env.DATE1 }} by HuoLeifeng
# - 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 Firmware to Release
if: env.PACKAGED_STATUS == 'success' && env.OPENWRT_RELEASE == 'true'
uses: ncipollo/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ env.DATE }} for ${{ env.OPENWRT_TAG }} from_N1_istore_24.04 ${{ env.EMOJI }}
allowUpdates: true
removeArtifacts: true
tag: ${{ env.OPENWRT_TAG }}
# token: ${{ secrets.GITHUB_TOKEN }}
artifacts: ${{ env.PACKAGED_OUTPUTPATH }}/*
body: |
This is OpenWrt firmware for N1
### 📒 Firmware information
- 🚀 ARMv8 多功能版,集成插件多
- 💻 平台架构: ${{ env.DEVICE_TARGET }}-${{ env.DEVICE_SUBTARGET }}
- ⚽ 固件源码: ${{ env.REPO_URL }}
- 💝 源码分支: ${{ env.REPO_BRANCH }}
- 🌐 Default IP: 192.168.2.3
- 🔑 Default username: root
- 🔑 Default password: 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 }}
- name: Delete workflow runs
uses: Mattraks/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
retain_days: 7
keep_minimum_runs: 3
- name: Remove old Releases
uses: dev-drprasad/[email protected]
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
with:
keep_latest: 5
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}