@@ -330,14 +330,32 @@ jobs:
330330 APP_STORE_API_KEY_ID : ${{ vars.APP_STORE_API_KEY_ID }}
331331 APP_STORE_API_ISSUER_ID : ${{ vars.APP_STORE_API_ISSUER_ID }}
332332 run : |
333+ set -o pipefail
333334 IPA="$(find build/ios/ipa -maxdepth 1 -name '*.ipa' | head -n 1)"
334335 [[ -n "$IPA" ]] || { echo "No IPA produced" >&2; exit 1; }
335336 echo "Uploading: $IPA"
337+
338+ # altool 在某些失败场景(如 bundle version 重复)会打印 ERROR 但仍以 0 退出。
339+ # 这里把 stdout/stderr 都收下并 tee 到日志,结束后扫描 ERROR 关键字强制失败。
340+ LOG="$RUNNER_TEMP/altool-upload.log"
341+ set +e
336342 xcrun altool --upload-app --type ios --file "$IPA" \
337343 --apiKey "$APP_STORE_API_KEY_ID" \
338344 --apiIssuer "$APP_STORE_API_ISSUER_ID" \
339345 --p8-file-path "$HOME/.appstoreconnect/private_keys/AuthKey_${APP_STORE_API_KEY_ID}.p8" \
340- --show-progress
346+ --show-progress 2>&1 | tee "$LOG"
347+ STATUS=${PIPESTATUS[0]}
348+ set -e
349+
350+ if [[ $STATUS -ne 0 ]]; then
351+ echo "::error::altool exited with status $STATUS" >&2
352+ exit "$STATUS"
353+ fi
354+ if grep -E '^[0-9-]+ [0-9:.]+ ERROR' "$LOG" >/dev/null; then
355+ echo "::error::altool reported ERROR despite exit 0 — failing step" >&2
356+ grep -E '^[0-9-]+ [0-9:.]+ ERROR' "$LOG" >&2 || true
357+ exit 1
358+ fi
341359
342360 publish :
343361 needs : release
@@ -353,10 +371,14 @@ jobs:
353371 name : android-apk
354372 path : ./artifacts
355373
356- - name : Create GitHub Release
374+ - name : Create GitHub Draft Release
375+ # 先发草稿,避免 iOS 还在 App Store 审核时 Android 这边就显示成"已正式发布"。
376+ # 等 App Store 审核通过并上线后,手动到 GitHub Releases 页面点 Publish;
377+ # 或用 `gh release edit <tag> --draft=false` 转正。
357378 uses : softprops/action-gh-release@v2
358379 with :
359380 tag_name : ${{ github.event.inputs.tag || github.ref_name }}
360381 files : ./artifacts/Echo-Loop-*-arm64.apk
361382 generate_release_notes : true
362383 fail_on_unmatched_files : true
384+ draft : true
0 commit comments