17
17
env :
18
18
DEVICE : ${{ github.event.client_payload.device || github.event.inputs.device }}
19
19
TG : ${{ secrets.TELEGRAM_BOT_TOKEN }}
20
+ DEPLOY_SSHKEY : ${{ secrets.SSH_KEY }}
20
21
if : github.event.repository.owner.id == github.event.sender.id
21
22
22
23
steps :
@@ -106,6 +107,7 @@ jobs:
106
107
mkdir -p ./artifact/buildinfo
107
108
mkdir -p ./release
108
109
cd lede
110
+ cp -a bin tmp ../
109
111
rm -rf $(find ./bin/targets/ -type d -name "packages")
110
112
cp -rf $(find ./bin/targets/ -type f) ../artifact/firmware/
111
113
cp -rf $(find ./bin/packages/ -type f -name "*.ipk") ../artifact/package/
@@ -114,7 +116,7 @@ jobs:
114
116
pushd ../release/ && md5sum $DEVICE.img.gz > md5sum.txt && popd
115
117
echo "strDate=$(TZ=UTC-8 date +%Y-%m-%d)" >> $GITHUB_ENV
116
118
echo "strDevice=$(echo $DEVICE | awk '{print toupper($0)}')" >> $GITHUB_ENV
117
- rm -rf bin/ tmp/
119
+ rm -rf bin tmp
118
120
cd ..
119
121
mv artifact release $GITHUB_WORKSPACE
120
122
@@ -176,3 +178,31 @@ jobs:
176
178
to : ${{ secrets.TELEGRAM_CHAT_ID }}
177
179
token : ${{ secrets.TELEGRAM_BOT_TOKEN }}
178
180
args : The ${{env.DEVICE}} build ran completed at ${{job.status}}.
181
+
182
+ - name : Build and deploy packages
183
+ if : env.DEPLOY_SSHKEY
184
+ run : |
185
+ cd
186
+ truncate -s +10G lede.img
187
+ sudo losetup -P --direct-io $LOOP_DEVICE lede.img
188
+ sudo mount -o nossd,compress=zstd $LOOP_DEVICE lede
189
+ sudo btrfs filesystem resize max lede/
190
+ mv bin tmp lede/
191
+ cd lede
192
+ find package/ -type d -name luci-app-* | rev | cut -d'/' -f1 | rev | sort | xargs -n1 -i echo CONFIG_PACKAGE_{}=m >> .config
193
+ make defconfig
194
+ make target/linux/compile -j$(($(nproc) + 1))
195
+ find package/ -type d -name luci-app-* | xargs -n1 -i sh -c "make {}/compile -j$(($(nproc) + 1)) || true"
196
+ make package/index
197
+ mkdir -p ~/.ssh; echo ${{env.DEPLOY_SSHKEY}} | base64 -d > ~/.ssh/id_ed25519; chmod 600 ~/.ssh/id_ed25519
198
+ rsync -avz --progress -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" \
199
+ bin/packages/*/base [email protected] :/usr/share/caddy/$DEVICE/
200
+ rsync -avz --progress -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" \
201
+ bin/targets/*/*/packages/ [email protected] :/usr/share/caddy/$DEVICE/core/
202
+
203
+ - name : Debug via tmate
204
+ uses : P3TERX/ssh2actions@main
205
+ if : ${{ failure() && env.TG }}
206
+ env :
207
+ TELEGRAM_BOT_TOKEN : ${{ secrets.TELEGRAM_BOT_TOKEN }}
208
+ TELEGRAM_CHAT_ID : ${{ secrets.TELEGRAM_CHAT_ID }}
0 commit comments