-
Notifications
You must be signed in to change notification settings - Fork 29
195 lines (183 loc) · 7.01 KB
/
Copy pathNanoPi-R5S-Plus.yml
File metadata and controls
195 lines (183 loc) · 7.01 KB
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
#=================================================
# https://github.com/P3TERX/Actions-OpenWrt
# Description: Build OpenWrt using GitHub Actions
# Lisence: MIT
# Author: P3TERX
# Blog: https://p3terx.com
#=================================================
name: NanoPi-R5S-全插件
on:
repository_dispatch:
workflow_dispatch:
#schedule:
#- cron: 0 17 * * *
# watch:
# types: started
env:
REPO_URL: https://github.com/DHDAXCW/lede
REPO_BRANCH: r5s-test
CONFIG_FILE: configs/lean/lean.config
DIY_SH: scripts/lean.sh
KMODS_IN_FIRMWARE: true
UPLOAD_RELEASE: true
TZ: Asia/Shanghai
jobs:
Build:
runs-on: self-hosted
outputs:
OPENWRTROOT: ${{ steps.update.outputs.OPENWRTROOT }}
PLATFORM: ${{ steps.compile.outputs.PLATFORM }}
TARGET: ${{ steps.compile.outputs.TARGET }}
SUBTARGET: ${{ steps.compile.outputs.SUBTARGET }}
FIRMWARE: ${{ steps.compile.outputs.FIRMWARE }}
GENERATE_STATUS: ${{ steps.generate.outputs.GENERATE_STATUS }}
steps:
- name: Checkout
uses: actions/checkout@main
- name: Initialization Environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
echo -e "Total CPU cores\t: $(nproc)"
cat /proc/cpuinfo | grep 'model name'
free -h
uname -a
[ -f /proc/version ] && cat /proc/version
[ -f /etc/issue.net ] && cat /etc/issue.net
[ -f /etc/issue ] && cat /etc/issue
ulimit -a
- name: Clone Source Code
run: |
df -hT $PWD
git config --global user.email "git@github.com"
git config --global user.name "GitHub"
git clone $REPO_URL -b $REPO_BRANCH openwrt
cd openwrt
- name: Update Feeds
id: update
run: |
cd openwrt
echo "OPENWRTROOT=$PWD" >> $GITHUB_ENV
echo "::set-output name=OPENWRTROOT::$(echo $PWD)"
mkdir customfeeds
git clone --depth=1 https://github.com/coolsnowwolf/packages customfeeds/packages
git clone --depth=1 https://github.com/coolsnowwolf/luci customfeeds/luci
chmod +x ../scripts/*.sh
../scripts/hook-feeds.sh
- name: Install Feeds
run: |
cd $OPENWRTROOT
./scripts/feeds install -a
- name: Load Custom Configuration
run: |
[ -e files ] && mv files $OPENWRTROOT/files
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE $OPENWRTROOT/.config
chmod +x scripts/*.sh
cd $OPENWRTROOT
../$DIY_SH
../scripts/preset-terminal-tools.sh
make defconfig
- name: Download Package
id: package
run: |
cd $OPENWRTROOT
cat .config
make download -j8
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
- name: Compile Packages
id: compile
run: |
cd $OPENWRTROOT
echo -e "$(nproc) thread compile"
make tools/compile -j$(nproc) || make tools/compile -j72
make toolchain/compile -j$(nproc) || make toolchain/compile -j72
make target/compile -j$(nproc) || make target/compile -j72 IGNORE_ERRORS=1
make diffconfig
make package/compile -j$(nproc) IGNORE_ERRORS=1 || make package/compile -j72 IGNORE_ERRORS=1
make package/index
cd $OPENWRTROOT/bin/packages/*
PLATFORM=$(basename `pwd`)
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
echo "::set-output name=PLATFORM::$(echo $PLATFORM)"
cd $OPENWRTROOT/bin/targets/*
TARGET=$(basename `pwd`)
echo "TARGET=$TARGET" >> $GITHUB_ENV
echo "::set-output name=TARGET::$(echo $TARGET)"
cd *
SUBTARGET=$(basename `pwd`)
echo "SUBTARGET=$SUBTARGET" >> $GITHUB_ENV
echo "::set-output name=SUBTARGET::$(echo $SUBTARGET)"
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "::set-output name=FIRMWARE::$(echo $PWD)"
echo "::set-output name=COMPILE_STATUS::success"
- name: Generate Firmware
if: steps.compile.outputs.COMPILE_STATUS == 'success'
id: generate
run: |
cd configs/opkg
sed -i "s/subtarget/$SUBTARGET/g" distfeeds*.conf
sed -i "s/target\//$TARGET\//g" distfeeds*.conf
sed -i "s/platform/$PLATFORM/g" distfeeds*.conf
cd $OPENWRTROOT
mkdir -p files/etc/uci-defaults/
cp ../scripts/init-settings.sh files/etc/uci-defaults/99-init-settings
mkdir -p files/etc/opkg
cp ../configs/opkg/distfeeds-packages-server.conf files/etc/opkg/distfeeds.conf.server
mkdir -p files/etc/opkg/keys
cp ../configs/opkg/1035ac73cc4e59e3 files/etc/opkg/keys/1035ac73cc4e59e3
if "$KMODS_IN_FIRMWARE" = 'true'
then
mkdir -p files/www/snapshots
cp -r bin/targets files/www/snapshots
cp ../configs/opkg/distfeeds-18.06-local.conf files/etc/opkg/distfeeds.conf
else
cp ../configs/opkg/distfeeds-18.06-remote.conf files/etc/opkg/distfeeds.conf
fi
cp files/etc/opkg/distfeeds.conf.server files/etc/opkg/distfeeds.conf.mirror
sed -i "s/http:\/\/192.168.123.100:2345\/snapshots/https:\/\/openwrt.cc\/snapshots\/$(date +"%Y-%m-%d")\/lean/g" files/etc/opkg/distfeeds.conf.mirror
make package/install -j$(nproc) || make package/install -j1 V=s
make target/install -j$(nproc) || make target/install -j1 V=s
rm -rf bin/targets/rockchip/armv8/openwrt-rockchip-armv8-friendlyarm_nanopi-r4*.manifest
rm -rf bin/targets/rockchip/armv8/openwrt-rockchip-armv8-friendlyarm_nanopi-r4*-rootfs.tar.gz
rm -rf bin/targets/rockchip/armv8/config.buildinfo
rm -rf bin/targets/rockchip/armv8/packages-server.zip
make checksum
echo "::set-output name=GENERATE_STATUS::success"
- name: Generate release tag
id: tag
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
run: |
echo "::set-output name=release_tag::$(date +"%Y.%m.%d")-Lean3"
echo "::set-output name=release_date::$(date +"%Y.%m.%d")"
touch release.txt
echo "后台地址:192.168.11.1" >> release.txt
echo "::set-output name=status::success"
- name: Upload firmware to release
uses: softprops/action-gh-release@v1
if: steps.tag.outputs.status == 'success' && !cancelled()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ steps.tag.outputs.release_date }} NanoPi-R5S-linux-5.19_正式版_全插件
tag_name: ${{ steps.tag.outputs.release_tag }}
body_path: release.txt
files: ${{ env.FIRMWARE }}/*
- name: Delete workflow runs
uses: GitRML/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 1
- name: Remove old Releases
uses: dev-drprasad/delete-older-releases@v0.1.0
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
with:
keep_latest: 20
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete Artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: |
bin-archive