generated from P3TERX/Actions-OpenWrt
-
Notifications
You must be signed in to change notification settings - Fork 76
178 lines (143 loc) · 4.83 KB
/
OWRT-CORE.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
#云编译公用核心
name: OWRT-CORE
on:
#公用核心标识
workflow_call:
inputs:
OWRT_TARGET:
required: true
type: string
OWRT_THEME:
required: true
type: string
OWRT_NAME:
required: true
type: string
OWRT_URL:
required: true
type: string
OWRT_PW:
required: true
type: string
OWRT_IP:
required: true
type: string
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
OWRT_TARGET: ${{inputs.OWRT_TARGET}}
OWRT_THEME: ${{inputs.OWRT_THEME}}
OWRT_NAME: ${{inputs.OWRT_NAME}}
OWRT_URL: ${{inputs.OWRT_URL}}
OWRT_PW: ${{inputs.OWRT_PW}}
OWRT_IP: ${{inputs.OWRT_IP}}
jobs:
owrt_core:
runs-on: ubuntu-latest
steps:
- name: Checkout Projects
uses: actions/checkout@main
- name: Initialization Environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
docker rmi $(docker images -q)
sudo -E rm -rf $(cat $GITHUB_WORKSPACE/Depends.txt | sed -n "1{s/\r$//;p;q}")
sudo -E apt -yqq update
sudo -E apt -yqq purge $(cat $GITHUB_WORKSPACE/Depends.txt | sed -n "2{s/\r$//;p;q}")
sudo -E apt -yqq full-upgrade
sudo -E apt -yqq install $(cat $GITHUB_WORKSPACE/Depends.txt | sed -n "3{s/\r$//;p;q}")
sudo -E apt -yqq autoremove --purge
sudo -E apt -yqq autoclean
sudo -E apt -yqq clean
sudo -E systemctl daemon-reload
sudo -E timedatectl set-timezone "Asia/Shanghai"
- name: Initialization Values
run: |
export OWRT_DATE=$(TZ=UTC-8 date +"%y.%m.%d_%H.%M.%S")
export OWRT_SOURCE=$(echo $OWRT_URL | cut -d '/' -f 5-)
export OWRT_TYPE=$(sed -n "1{s/^#//;s/\r$//;p;q}" $GITHUB_WORKSPACE/Config/$OWRT_TARGET.txt)
echo "OWRT_SOURCE=$OWRT_SOURCE" >> $GITHUB_ENV
echo "OWRT_TARGET=$OWRT_TARGET" >> $GITHUB_ENV
echo "OWRT_DATE=$OWRT_DATE" >> $GITHUB_ENV
echo "OWRT_TYPE=$OWRT_TYPE" >> $GITHUB_ENV
echo "OWRT_PW=$OWRT_PW" >> $GITHUB_ENV
echo "OWRT_IP=$OWRT_IP" >> $GITHUB_ENV
- name: Check Scripts
run: |
cd ./Scripts
dos2unix ./*.sh
chmod +x ./*.sh
- name: Clone OWRT Code
run: |
git clone $OWRT_URL ./owrt
- name: Load custom feeds
run: |
cd ./owrt
echo 'src-git smpackage https://github.com/kenzok8/small-package' >> feeds.conf.default
- name: Update Feeds
run: |
cd ./owrt
./scripts/feeds update -a
./scripts/feeds install -a
- name: Custom Scripts
run: |
cd ./owrt
$GITHUB_WORKSPACE/Scripts/Settings.sh
cd ./package
$GITHUB_WORKSPACE/Scripts/Plugins.sh
- name: Custom Settings
run: |
cd ./owrt
rm -rf ./tmp* ./.config*
cat $GITHUB_WORKSPACE/Config/$OWRT_TARGET.txt $GITHUB_WORKSPACE/Config/General.txt >> .config
$GITHUB_WORKSPACE/Scripts/Extras.sh
make defconfig
- name: Cleanup Toolchain
run: |
cd ./owrt
make dirclean
- name: Download Packages
run: |
cd ./owrt
make download -j$(nproc)
- name: Compile Firmware
run: |
cd ./owrt
make -j$(nproc) || make -j1 V=s
echo "======================="
df -h
echo "======================="
du -h --max-depth=1
echo "======================="
- name: Package Firmware
run: |
cd ./owrt && mkdir ./upload
rm -rf $(find ./bin/targets/ -iregex ".*\(json\|manifest\|buildinfo\|sha256sums\|packages\)$")
cp -rf $(find ./bin/targets/ -type f -iname "*.*") ./upload/
cp -rf ./.config ./upload/Config_"$OWRT_TARGET"_"$OWRT_SOURCE"_"$OWRT_DATE".txt
cd ./upload
$GITHUB_WORKSPACE/Scripts/Renames.sh
- name: Release Firmware
uses: softprops/action-gh-release@master
with:
tag_name: ${{env.OWRT_TARGET}}_${{env.OWRT_SOURCE}}_${{env.OWRT_DATE}}
files: ./owrt/upload/*.*
body: |
这是个平台固件包,内含多个设备!
请注意选择你需要的设备固件!
不要问,更就完事了!
源码:${{env.OWRT_SOURCE}}
平台:${{env.OWRT_TARGET}}
设备:${{env.OWRT_TYPE}}
密码:${{env.OWRT_PW}}
地址:${{env.OWRT_IP}}
- name: Delete Old Releases
uses: dev-drprasad/delete-older-releases@master
with:
keep_latest: 6
delete_tags: true
- name: Delete Old Workflows
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 0
keep_minimum_runs: 1