fix(ci): gate iOS release automation on successful Analyze - #81
Open
CNDY1390 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the iOS release automation to only proceed when the Analyze workflow has completed successfully for the exact merge/tag SHA, preventing tag creation and release dispatch when CI hasn’t passed yet.
Changes:
- Rework Auto Tag iOS Release to trigger from
workflow_runofAnalyze(push tomaster, conclusionsuccess), then resolve the merged PR + release label from the analyzedhead_sha. - Add an Analyze-result gate to Dispatch iOS Release by verifying an existing successful
Analyzerun matches the release tag’s resolvedTAG_SHA. - Add safeguards for idempotency and version ordering (skip if SHA already tagged; refuse tagging older history as newer version).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/dispatch-ios-release.yml | Adds an explicit “Analyze must have succeeded for TAG_SHA” gate before dispatching the private signing workflow; updates permissions for Actions API reads. |
| .github/workflows/auto-tag-ios-release.yml | Switches to workflow_run trigger from Analyze success on master, resolves PR/labels via SHA, enforces idempotency + ancestry checks, then tags + dispatches release. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+84
to
+91
| analyze_runs="$( | ||
| gh api --method GET \ | ||
| "/repos/$REPOSITORY/actions/workflows/analyze.yml/runs" \ | ||
| -f event=push \ | ||
| -f status=success \ | ||
| -f head_sha="$TAG_SHA" \ | ||
| -f per_page=100 | ||
| )" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
原来的 iOS 自动发布流程监听 PR 合并事件:
该流程不会等待合并提交在
master上的flutter analyze完成。此前 PR #71 合并后,自动流程创建了
ios-v0.4.0+1,但代码中的TargetPlatform.ohos随后导致 Analyze 和 iOS 构建失败。核心问题:CI 尚未通过,发布流程已经开始。修改目标
master对应提交的 Analyze 完成。ios:release:*Label。flutter analyze。修改内容
Auto Tag iOS Release触发条件从:
改为:
仅在以下条件全部成立时继续:
随后:
head_sha。ios:release:patch/minor/majorLabel。Dispatch iOS Release。Dispatch iOS Release派遣私有签名仓库前增加 Analyze 门禁:
TAG_SHA。analyze.yml已有的 Workflow Runs。找不到对应结果:拒绝派遣私有仓库。
该步骤只查询已有 CI 结果,不会重新运行
flutter analyze。最终流程
验证
git diff --check通过。TechPie-release仓库未修改。尚未验证:真实 GitHub Actions 端到端运行。
workflow_run必须进入默认分支后才能进行真实验证。请重点 Review
workflow_run的触发条件是否正确。head_sha是否始终对应准备发布的准确提交。TAG_SHA的过滤是否正确。actions: read/write、contents: write权限是否合理。GITHUB_TOKEN创建 Tag 后,再显式调用workflow_dispatch的逻辑是否正确。合并后预期行为