From 3ef258773273e79cfebae8a9288b3153f02d9962 Mon Sep 17 00:00:00 2001 From: Del Wang Date: Sun, 13 Apr 2025 11:56:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=20OTA=20=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/LX06.yaml | 9 ++++++--- .github/workflows/OH2P.yaml | 9 ++++++--- packages/client-patch/src/ota.ts | 9 +++++++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/LX06.yaml b/.github/workflows/LX06.yaml index c174c90..0f85cff 100644 --- a/.github/workflows/LX06.yaml +++ b/.github/workflows/LX06.yaml @@ -1,6 +1,11 @@ name: 小爱音箱 Pro(LX06) on: workflow_dispatch: + inputs: + ota: + description: " 请输入 OTA 版本信息" + type: string + required: true jobs: build: @@ -19,9 +24,7 @@ jobs: - name: 🔥 构建固件 id: build env: - MI_USER: ${{ secrets.MI_USER }} - MI_PASS: ${{ secrets.MI_PASS }} - MI_DEVICE: 小爱音箱Pro + OTA: ${{ inputs.ota }} SSH_PASSWORD: open-xiaoai run: | cd packages/client-patch diff --git a/.github/workflows/OH2P.yaml b/.github/workflows/OH2P.yaml index aabc7d7..5c65335 100644 --- a/.github/workflows/OH2P.yaml +++ b/.github/workflows/OH2P.yaml @@ -1,6 +1,11 @@ name: Xiaomi 智能音箱 Pro(OH2P) on: workflow_dispatch: + inputs: + ota: + description: " 请输入 OTA 版本信息" + type: string + required: true jobs: build: @@ -19,9 +24,7 @@ jobs: - name: 🔥 构建固件 id: build env: - MI_USER: ${{ secrets.MI_USER }} - MI_PASS: ${{ secrets.MI_PASS }} - MI_DEVICE: Xiaomi 智能音箱 Pro + OTA: ${{ inputs.ota }} SSH_PASSWORD: open-xiaoai run: | cd packages/client-patch diff --git a/packages/client-patch/src/ota.ts b/packages/client-patch/src/ota.ts index bd2e50a..488edf6 100644 --- a/packages/client-patch/src/ota.ts +++ b/packages/client-patch/src/ota.ts @@ -82,8 +82,13 @@ async function getOTA(channel: "release" | "current" | "stable" = "release") { async function main() { console.log(`🔥 正在获取设备信息...`); - const ota = await getOTA(); - if (!ota) { + let ota: any = {}; + if (process.env.OTA) { + ota = JSON.parse(process.env.OTA); + } else { + ota = await getOTA(); + } + if (!ota.url) { console.log(`❌ 获取设备信息失败`); process.exit(1); }