-
-
Notifications
You must be signed in to change notification settings - Fork 23
153 lines (137 loc) · 5.04 KB
/
master.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
name: Build
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
inputs:
platform:
description: Platform
required: false
env:
TAG_NAME: latest
jobs:
buildroot:
name: Firmware
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- gk7202v300_lite_cootli_camv0103
- gk7202v300_lite_xg521
- gk7205v200_lite_vixand-ipc-1
- gk7205v200_lite_vixand-iph-5-4g
- gk7205v210_lite_vixand-ivg-g3s
- gk7205v210_lite_vixand-ivg-g4f-a
- gk7205v210_lite_vixand-ivg-g4f-a-w
- hi3516cv200_lite_trassir-tr-d4121ir1-v2
- hi3518ev200_lite_smartwares-cip-37210
- hi3518ev200_lite_switcam-hs303
- hi3518ev200_lite_switcam-hs303-v2
- hi3518ev200_lite_vstarcam-c8892wip
- hi3518ev200_lite_qtech-qvc-ipc-136w
- hi3518ev300_lite_bathhouse
- hi3518ev300_lite_xiaomi-mjsxj02hl
- hi3518ev200_ultimate_lenovo-snowman-1080p
- ssc30kd_lite_chinatelecom-ds-ytj5301
- ssc325_lite_imilab-ec3-cmsxj25a
- ssc325_lite_tp-link-tapo-c310-v1
- ssc325_lite_trassir-tr-w2c1-v1
- ssc325de_lite_imou-c22ep-s2
- ssc333_lite_meari-speed-6s
- ssc333_lite_tp-link-tapo-c110-v2
- ssc333_lite_babysense-see-hd-ip206
- ssc333_lite_vstarcam-c43s_b
- ssc335_lite_tp-link-tapo-c110-v1
- ssc335_lite_trassir-tr-w2c1-v2
- ssc335de_lite_uniview-c1l-2wn-g
- ssc337_lite_h3c-tc2101
- ssc337_lite_tp-link-tapo-c110-v1
- ssc337de_ultimate_foscam-x5
- ssc338q_fpv_openipc-urllc-aio
- t10_lite_hb-wifi-z6
- t20_ultimate_azarton-c1
- t20_lite_ec37-t11
- t31_lite_vstarcam-cs55
- t21_lite_chinamobile-hdc-51-a5-v12
- t21_lite_smartwares-cip-37210at
- t21_lite_xyx-06s
- t21_lite_wansview-q5-1080p
- t31_lite_wansview-q5-2k
- t31_lite_aoni-ep01j05
- t31_lite_chinamobile-hdc-51-a6-v11
- t31_lite_chinatelecom-y4h-50
- t31_lite_wyze-v3b
- t31_lite_xiaomi-mjsxj03hl
- t31_lite_xiaomi-mjsxj03hl-jxq03
- t31_lite_tuya-gv7630-t31-ptz
- t31_ultimate_azarton-c1-t31x
- t31_ultimate_gcraftsman-gca50
- t31_lite_zte-k540
- t10_lite_jvs-ingt10-gqs60ep
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Prepare firmware
run: |
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
echo CACHE_DATE=$(date +%m) >> ${GITHUB_ENV}
git clone https://github.com/openipc/firmware --depth 1
- name: Dispatch platform
run: |
INPUT=${{inputs.platform}}
MATRIX=$(echo ${{matrix.platform}} | cut -d_ -f1)
if [ -z ${INPUT} ] || [ ${INPUT} = ${MATRIX} ]; then
echo RUN=${MATRIX} >> ${GITHUB_ENV}
fi
- name: Setup ccache
if: env.RUN
uses: actions/cache@v4
with:
path: /tmp/ccache
key: ${{matrix.platform}}-${{env.CACHE_DATE}}
- name: Build firmware
if: env.RUN
run: |
export GIT_HASH=$(git rev-parse --short ${GITHUB_SHA})
export GIT_BRANCH=${GITHUB_REF_NAME}
echo GIT_HASH=${GIT_HASH} >> ${GITHUB_ENV}
echo GIT_BRANCH=${GIT_BRANCH} >> ${GITHUB_ENV}
mkdir -p /tmp/ccache
ln -s /tmp/ccache ${HOME}/.ccache
NAME=${{matrix.platform}}
bash builder.sh ${NAME}
cd openipc
TIME=$(date -d @${SECONDS} +%M:%S)
echo TIME=${TIME} >> ${GITHUB_ENV}
NORFW=$(find output/images -name openipc*nor*)
if [ ! -z ${NORFW} ]; then
mv ${NORFW} ../${NAME}-nor.tgz
echo NORFW=${GITHUB_WORKSPACE}/${NAME}-nor.tgz >> ${GITHUB_ENV}
fi
NANDFW=$(find output/images -name openipc*nand*)
if [ ! -z ${NANDFW} ]; then
mv ${NANDFW} ../${NAME}-nand.tgz
echo NANDFW=${GITHUB_WORKSPACE}/${NAME}-nand.tgz >> ${GITHUB_ENV}
fi
if [ -z ${NORFW} ] && [ -z ${NANDFW} ]; then
exit 1
fi
- name: Upload firmware
if: env.NORFW || env.NANDFW
uses: softprops/action-gh-release@v2
with:
tag_name: latest
files: |
${{env.NORFW}}
${{env.NANDFW}}
- name: Send binary
if: env.NORFW
run: |
TG_MSG="Commit: ${GIT_HASH}\nBranch: ${GIT_BRANCH}\nTag: ${TAG_NAME}\nTime: ${TIME}\n\n"
TG_ICON="\xE2\x9C\x85 GitHub Actions"
TG_HEADER=$(echo -e ${TG_MSG}${TG_ICON})
TG_TOKEN=${{secrets.TELEGRAM_TOKEN_BOT_OPENIPC}}
TG_CHANNEL=${{secrets.TELEGRAM_CHANNEL_OPENIPC_DEV}}
HTTP=$(curl -s -o /dev/null -w %{http_code} https://api.telegram.org/bot${TG_TOKEN}/sendDocument -F chat_id=${TG_CHANNEL} -F caption="${TG_HEADER}" -F document=@${NORFW})
echo Telegram response: ${HTTP}