fix: macOS 构建去掉 --no-codesign;build-bot 失败也回帖结果
- flutter build macos 不支持 --no-codesign(那是 iOS 的选项), 传了会直接报 'Could not find an option named no-codesign' 导致编译失败。 macOS 模板本身用 ad-hoc 签名,CI 无证书也能构建。 - 删除 workflow 里的 GC_NO_CODESIGN 环境变量 - build-bot 新增独立 report job(always): 编译/发布任何一步失败都会回帖,列出各平台结果与日志链接, 不再因为 publish 被跳过而静默
This commit is contained in:
1 parent
ab0cee8b40
commit
936ef8333e
4 files changed
+50
-21
No files matched your search
+1
-1
@@ -59,5 +59,5 @@
|
||||
- `Settings → Actions → General → Workflow permissions` 给 **Read and write**,
|
||||
否则 `gh release` / 评论接口会 403(工作流里已声明 `permissions:`,但组织策略可能覆盖)。
|
||||
- Secrets 不需要额外配置,统一用内置的 `GITHUB_TOKEN`。
|
||||
- macOS 产物是 **未签名** 的(`GC_NO_CODESIGN=1`)。下载后首次打开需右键 →「打开」,
|
||||
- macOS 产物是 **ad-hoc 签名**(无开发者证书)。下载后首次打开需右键 →「打开」,
|
||||
或在「系统设置 → 隐私与安全性」里放行。
|
||||
@@ -136,7 +136,6 @@ jobs:
|
||||
|
||||
- name: 编译 macOS
|
||||
env:
|
||||
GC_NO_CODESIGN: '1'
|
||||
GC_NO_PROGRESS: '1'
|
||||
run: ./build.sh build --targets=mac
|
||||
|
||||
@@ -252,18 +251,52 @@ jobs:
|
||||
|
||||
echo "https://github.com/${{ github.repository }}/releases/tag/$TAG" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- name: 回帖
|
||||
if: always()
|
||||
# 结果回帖独立成一个 job:编译失败 / 发布失败也要有回音,
|
||||
# 不能因为 publish 被跳过就静默。
|
||||
report:
|
||||
needs: [prepare, build-mac, build-win, publish]
|
||||
if: always() && needs.prepare.outputs.ok == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 回帖结果
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TARGET: ${{ needs.prepare.outputs.target }}
|
||||
ISSUE: ${{ github.event.issue.number }}
|
||||
STATE: ${{ steps.publish_step.outcome }}
|
||||
TARGET: ${{ needs.prepare.outputs.target }}
|
||||
REF: ${{ needs.prepare.outputs.ref }}
|
||||
MAC: ${{ needs.build-mac.result }}
|
||||
WIN: ${{ needs.build-win.result }}
|
||||
PUB: ${{ needs.publish.result }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run: |
|
||||
if [ "$STATE" = "success" ]; then
|
||||
MSG="已编译 **${TARGET}** 并发布到预发布:https://github.com/${{ github.repository }}/releases/tag/ip-prerelease"
|
||||
else
|
||||
MSG="编译 **${TARGET}** 失败,见日志:${RUN_URL}"
|
||||
fi
|
||||
gh issue comment "$ISSUE" --body "$MSG"
|
||||
set -e
|
||||
REPO="${{ github.repository }}"
|
||||
|
||||
line() {
|
||||
case "$2" in
|
||||
success) echo "- $1:✅ 成功" ;;
|
||||
skipped) echo "- $1:⏭ 未请求(跳过)" ;;
|
||||
cancelled) echo "- $1:⛔ 已取消" ;;
|
||||
*) echo "- $1:❌ 失败" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
{
|
||||
if [ "$PUB" = "success" ]; then
|
||||
echo "✅ **编译完成**:\`${TARGET}\`"
|
||||
else
|
||||
echo "❌ **编译未完成**:\`${TARGET}\`"
|
||||
fi
|
||||
echo
|
||||
line "macOS" "$MAC"
|
||||
line "Windows" "$WIN"
|
||||
echo
|
||||
echo "- 来源提交:\`${REF:0:7}\`"
|
||||
if [ "$PUB" = "success" ]; then
|
||||
echo "- 产物:https://github.com/${REPO}/releases/tag/ip-prerelease"
|
||||
else
|
||||
echo "- 日志:${RUN_URL}"
|
||||
fi
|
||||
} > result.md
|
||||
|
||||
gh issue comment "$ISSUE" --body-file result.md
|
||||
@@ -59,7 +59,6 @@ jobs:
|
||||
- name: 编译 macOS
|
||||
env:
|
||||
GC_TARGETS: mac
|
||||
GC_NO_CODESIGN: '1'
|
||||
GC_NO_PROGRESS: '1'
|
||||
run: ./build.sh build --targets=mac
|
||||
|
||||
|
||||
@@ -37,15 +37,12 @@ flutter_build() {
|
||||
_flutter pub get || return 1
|
||||
fi
|
||||
|
||||
# CI 上没有签名证书:GC_NO_CODESIGN=1 时给 macOS 加 --no-codesign,
|
||||
# 直接产出未签名的 .app(用户首次打开需右键「打开」或在系统设置里放行)。
|
||||
_flags="--release"
|
||||
if [ "${GC_NO_CODESIGN:-0}" = 1 ] && [ "$_plat" = macos ]; then
|
||||
_flags="$_flags --no-codesign"
|
||||
fi
|
||||
|
||||
# 注意:macOS 的 `flutter build macos` 没有 --no-codesign 选项(那是 iOS 的),
|
||||
# 传了会直接报 "Could not find an option named no-codesign"。
|
||||
# macOS 模板默认用 ad-hoc 签名(CODE_SIGN_IDENTITY = "-"),无证书的 CI 也能构建出 .app,
|
||||
# 只是首次打开需要右键「打开」。
|
||||
run_logged "$GC_ROOT/build/logs/flutter-$_plat.log" "Flutter $_plat 构建 " \
|
||||
_flutter build "$_plat" $_flags || return 1
|
||||
_flutter build "$_plat" --release || return 1
|
||||
step_ok "Flutter ${_plat}"
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user