forked from vb1980/Padavan_CI
-
Notifications
You must be signed in to change notification settings - Fork 0
172 lines (170 loc) · 5.29 KB
/
build_hanwckf_kernal4.4_padavan.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
name: Build hanwckf's kernal4.4 Padavan
on:
workflow_dispatch:
inputs:
target:
type: choice
description: 'target to compile'
options:
- Xiaomi_CR6606
- Xiaomi_CR6608
- Xiaomi_CR6609
- JCQ_Q20
- JCQ_Q10Pro
- JCG_836PRO
- JCG_AC860M
- JCG_Y2
- DLINK_DIR-878
- DLINK_DIR-882
- Phicomm_K2P
- Phicomm_K2P-USB
- Motorola_MR2600
- Xiaomi_R3P
- Xiaoyu_C1
- Xiaoyu_C3
- Xiaoyu_C5
uploadanon:
type: boolean
description: 'upload firmware to anonfiles'
default: 'false'
env:
REPOSITORY_URL: https://github.com/hanwckf/padavan-4.4.git
TOOLCHAIN_URL: https://github.com/hanwckf/padavan-toolchain/releases/download/linux-4.4-v1.0/mipsel-linux-uclibc.tar.xz
WORK_PATH: /opt/padavan-4.4
TIME_ZONE: Asia/Shanghai
FIRMWARE_AUTHOR: hanwckf
FIRMWARE_PATH: /opt/firmwares
jobs:
build:
runs-on: ubuntu-20.04
if: github.event.repository.owner.id == github.event.sender.id
steps:
- uses: actions/checkout@v4
- uses: Bonnie2980/variable-mapper@master
id: export
with:
key: "${{ github.event.inputs.target }}"
map: |
{
"Xiaomi_CR6606": {
"model": "CR660x"
},
"Xiaomi_CR6608": {
"model": "CR660x"
},
"Xiaomi_CR6609": {
"model": "CR660x"
},
"JCQ_Q20": {
"model": "JCG-Q20"
},
"JCQ_Q10Pro": {
"model": "JCG-Q20"
},
"JCG_836PRO": {
"model": "JCG-836PRO"
},
"JCG_AC860M": {
"model": "JCG-AC860M"
},
"JCG_Y2": {
"model": "JCG-Y2"
},
"DLINK_DIR-882": {
"model": "DIR-882"
},
"DLINK_DIR-878": {
"model": "DIR-878"
},
"Phicomm_K2P": {
"model": "K2P"
},
"Phicomm_K2P-USB": {
"model": "K2P-USB"
},
"Motorola_MR2600": {
"model": "MR2600"
},
"Xiaomi_R3P": {
"model": "MI-R3P"
},
"Xiaoyu_C1": {
"model": "XY-C1"
},
"Xiaoyu_C3": {
"model": "XY-C1"
},
"Xiaoyu_C5": {
"model": "XY-C1"
},
".*": {
"model": "K2P"
}
}
export_to: env
mode: first_match
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt install unzip libtool-bin curl cmake gperf gawk flex bison nano xxd \
fakeroot kmod cpio git python3-docutils gettext automake autopoint \
texinfo build-essential help2man pkg-config zlib1g-dev libgmp3-dev \
libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget libc-dev-bin
sudo timedatectl set-timezone "$TIME_ZONE"
- name: Clone source code
run: |
git clone --depth=1 $REPOSITORY_URL $WORK_PATH
cd $WORK_PATH/toolchain-mipsel
mkdir -p toolchain-4.4.x
wget $TOOLCHAIN_URL
tar -xf mipsel-linux-uclibc.tar.xz -C toolchain-4.4.x
- name: Set environment variables
run: |
git config --global log.date format:'%Y%m%d'
cd $WORK_PATH
echo "FIRMWARE_VERSION=$(git log -1 --pretty=format:"%cd")" >> $GITHUB_ENV
echo "FIRMWARE_DATEPREFIX=$(date +"%Y%m%d")" >> $GITHUB_ENV
- name: Custom config
run: |
cd $WORK_PATH/trunk
if [ ! -f configs/templates/${{ env.model }}.config ] ; then
echo "configs/templates/${{ env.model }}.config not found"
exit 1
fi
cp -f configs/templates/${{ env.model }}.config .config
sed -i "s/FIRMWARE_BUILDS_REV=.*/FIRMWARE_BUILDS_REV=${FIRMWARE_VERSION}/g" ./versions.inc
- name: Build firmware
run: |
cd $WORK_PATH/trunk
./clear_tree
fakeroot ./build_firmware_modify ${{ env.model }}
- name: Organize firmware files
run: |
mkdir -p $FIRMWARE_PATH/
cd $WORK_PATH/trunk/images
for firmwarefile in $(ls *.trx)
do sudo mv $firmwarefile $FIRMWARE_PATH/${FIRMWARE_DATEPREFIX}"_"${FIRMWARE_AUTHOR}"_"${{ env.model }}"_kernal4.4.trx"
done
cd $FIRMWARE_PATH
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "STATUS=success" >> $GITHUB_ENV
- name : Upload packages
uses: actions/upload-artifact@master
if: env.STATUS == 'success'
with:
name: Padavan44-packages
path: ${{ env.FIRMWARE }}
- name: Upload firmware to anonfiles
if: env.STATUS == 'success' && github.event.inputs.uploadanon == 'true'
run: |
curl -fsSL git.io/file-transfer | sh
./transfer anon --no-progress ${FIRMWARE} 2>&1 | tee anonfile.log
echo "::warning file=anonfile.com::$(cat anonfile.log | grep -o -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*")"
- name: Remove obsolete firmwares on artifacts
uses: Bonnie2980/gha-remove-artifacts@master
if: env.STATUS == 'success'
with:
age: '1 day'
skip-recent: 5