-
Notifications
You must be signed in to change notification settings - Fork 10
250 lines (235 loc) · 12.1 KB
/
check.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
name: Check firmware update
on:
schedule:
- cron: '0 0 * * *'
push:
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- model: "SM-E625F"
region: "INS"
imei: "350641034358959"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G970F"
region: "DBT"
imei: "354889108726363"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G970N"
region: "KOO"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G973F"
region: "DBT"
imei: "356127105158894"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G973N"
region: "KOO"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G975F"
region: "DBT"
imei: "356172100810248"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G975N"
region: "KOO"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G977B"
region: "VD2"
imei: "356151100525758"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_5g.bin.lz4 modem_debug.bin.lz4 modem_debug_5g.bin.lz4"
- model: "SM-G977N"
region: "KOO"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_5g.bin.lz4 modem_debug.bin.lz4 modem_debug_5g.bin.lz4"
- model: "SM-G980F"
region: "DBT"
imei: "356007117597901"
files_ap: "dqmdbg.img.lz4"
files_bl: "harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 ssp.img.lz4 tzar.img.lz4 tzsw.img.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G985F"
region: "DBT"
imei: "356844831856563"
files_ap: "dqmdbg.img.lz4"
files_bl: "harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 ssp.img.lz4 tzar.img.lz4 tzsw.img.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G981B"
region: "DBT"
imei: "354397115116271"
files_ap: "dqmdbg.img.lz4"
files_bl: "harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 ssp.img.lz4 tzar.img.lz4 tzsw.img.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G986B"
region: "DBT"
imei: "359847104662532"
files_ap: "dqmdbg.img.lz4"
files_bl: "harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 ssp.img.lz4 tzar.img.lz4 tzsw.img.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G988B"
region: "DBT"
imei: "354568111610570"
files_ap: "dqmdbg.img.lz4"
files_bl: "harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 ssp.img.lz4 tzar.img.lz4 tzsw.img.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-G991B"
region: "DBT"
imei: "357275657904162"
files_bl: "harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 ssp.img.lz4 tzar.img.lz4 tzsw.img.lz4 uh.bin.lz4 up_param.bin.lz4 vddcal_fw.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-M625F"
region: "EGY"
imei: "354295851027712"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-N970F"
region: "DBT"
imei: "357452104639739"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-N971N"
region: "KOO"
imei: "358777105279203"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_5g.bin.lz4 modem_debug.bin.lz4 modem_debug_5g.bin.lz4"
- model: "SM-N975F"
region: "DBT"
imei: "356210102048357"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-N976B"
region: "BTU"
imei: "358782100103564"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_5g.bin.lz4 modem_debug.bin.lz4 modem_debug_5g.bin.lz4"
- model: "SM-N976N"
region: "KOO"
files_ap: "dqmdbg.img.lz4"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 param.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_5g.bin.lz4 modem_debug.bin.lz4 modem_debug_5g.bin.lz4"
- model: "SM-P610"
region: "XEF"
imei: "R52N804CKLF"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
- model: "SM-P615"
region: "XEF"
imei: "353919118587132"
files_bl: "cm.bin.lz4 keystorage.bin.lz4 sboot.bin.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin.lz4 modem_debug.bin.lz4"
- model: "SM-P620"
region: "EUX"
imei: "R52X407BTPE"
files_ap: "modem.bin.lz4 modem_debug.bin.lz4"
files_bl: "fld.bin.lz4 harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 tzsw.img.lz4 tzar.img.lz4 uh.bin.lz4 up_param.bin.lz4"
- model: "SM-P625"
region: "EUX"
imei: "R52X404Z7LP"
files_bl: "fld.bin.lz4 harx.bin.lz4 keystorage.bin.lz4 ldfw.img.lz4 sboot.bin.lz4 tzsw.img.lz4 tzar.img.lz4 uh.bin.lz4 up_param.bin.lz4"
files_cp: "modem.bin modem_debug.bin"
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y lz4 python3-pip
pip3 install git+https://github.com/martinetd/samloader.git
- name: Compare latest version with current version
id: check
run: |
need_update=0
latest=`samloader -m ${{ matrix.model }} -r ${{ matrix.region }} checkupdate`
latest_short=`echo $latest | cut -f1 -d '/'`
current=`cat current.${{ matrix.model }}` || need_update=1
[[ $latest != $current ]] && need_update=1
echo "latest_version=$latest" >> $GITHUB_OUTPUT
echo "latest_version_short=$latest_short" >> $GITHUB_OUTPUT
echo "need_update=$need_update" >> $GITHUB_OUTPUT
- name: Fetch firmware
if: steps.check.outputs.need_update == 1
run: |
samloader -m ${{ matrix.model }} -r ${{ matrix.region }} -i ${{ matrix.imei }} download -v ${{ steps.check.outputs.latest_version }} -o ${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.zip.enc4 -D
mkdir -p out
echo ${{ steps.check.outputs.latest_version_short }} >> version.txt
- name: Extract images from AP
if: steps.check.outputs.need_update == 1 && matrix.files_ap
run: |
unzip -p ${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.zip "AP*" | tar xvf - -C out ${{ matrix.files_ap }}
cd out; for IMAGE in ${{ matrix.files_ap }}; do [ "$(echo $IMAGE | rev | cut -f1 -d '.' | rev)" = "lz4" ] && lz4 -d -m --rm $IMAGE; done; cd ..
- name: Extract images from BL
if: steps.check.outputs.need_update == 1 && matrix.files_bl
run: |
unzip -p ${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.zip "BL*" | tar xvf - -C out ${{ matrix.files_bl }}
cd out; for IMAGE in ${{ matrix.files_bl }}; do [ "$(echo $IMAGE | rev | cut -f1 -d '.' | rev)" = "lz4" ] && lz4 -d -m --rm $IMAGE; done; cd ..
- name: Extract images from CP
if: steps.check.outputs.need_update == 1 && matrix.files_cp
run: |
unzip -p ${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.zip "CP*" | tar xvf - -C out ${{ matrix.files_cp }}
cd out; for IMAGE in ${{ matrix.files_cp }}; do [ "$(echo $IMAGE | rev | cut -f1 -d '.' | rev)" = "lz4" ] && lz4 -d -m --rm $IMAGE; done; cd ..
- name: Generate heimdall info
if: steps.check.outputs.need_update == 1
run: |
make -C tools/pithelper
unzip -p ${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.zip "CSC*" | tar xvf - --wildcards *.pit
HEIMDALL_COMMAND="heimdall flash"
cd out; for IMAGE in *; do HEIMDALL_COMMAND="$HEIMDALL_COMMAND --$(../tools/pithelper/get-pit-partition ../*.pit $IMAGE) $IMAGE"; done; cd ..
echo $HEIMDALL_COMMAND > heimdall.txt
- name: Archive images for upload
if: steps.check.outputs.need_update == 1
run: |
cd out; tar cvf ../firmware-${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.tar *; cd ..
sha256sum firmware-${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.tar > firmware-${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.tar.sha256
- name: Update current version
if: steps.check.outputs.need_update == 1
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull origin ${{github.ref}} --ff-only
echo ${{ steps.check.outputs.latest_version }} > current.${{ matrix.model }}
git add current.${{ matrix.model }}
git commit -m "${{ matrix.model }}: ${{ steps.check.outputs.latest_version }}"
git tag ${{ steps.check.outputs.latest_shortversion }}
- name: Push changes to repo
if: steps.check.outputs.need_update == 1
uses: ad-m/github-push-action@master
with:
tags: true
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release assets
if: steps.check.outputs.need_update == 1
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: heimdall.txt
tag_name: ${{ steps.check.outputs.latest_version_short }}
files: |
firmware-${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.tar
firmware-${{ matrix.model }}-${{ steps.check.outputs.latest_version_short }}.tar.sha256
heimdall.txt