Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(release): close the tracking issue before App Store delivery

tianma-ifc894f259e364
diff --git a/docs/release.md b/docs/release.md
index d316944a..37ebf1c5 100644
--- a/docs/release.md
+++ b/docs/release.md
@@ -81,8 +81,10 @@ actually needed.
`bun run publish:stores -- --release vX.Y.Z --platform android --android-track production`
for that Draft, then rerun the original release command to resume. When the
audited range includes iOS runtime changes, the same command starts Xcode
- Cloud and submits App Review after GitHub publication. An iOS failure leaves
- the GitHub Release published; retry with
+ Cloud and submits App Review after GitHub publication. Once post-publication
+ audits pass, the script closes the tracking Issue and then waits for App
+ Store delivery. An iOS failure leaves the GitHub Release published and that
+ Issue closed; retry with
`bun run publish:stores -- --release vX.Y.Z --platform ios`. See
[Mobile Store Delivery](store-delivery.md).
- After rebuilt desktop assets are uploaded to the Draft, the local release
@@ -113,5 +115,7 @@ Independent builds are not required to have the same registry digest.
run instead of creating another Issue, commit, or Release.
- A failed post-publication native or GHCR audit attempts to return the Release to
Draft and leaves the Issue open.
+- After those audits pass, the script closes the tracking Issue before waiting
+ for App Store delivery. A later App Store failure leaves that Issue closed.
- If an explicit application installation fails, the script restores the previous
app from its macOS Trash backup when possible.
diff --git a/docs/release.zh-CN.md b/docs/release.zh-CN.md
index cf62e028..c370b212 100644
--- a/docs/release.zh-CN.md
+++ b/docs/release.zh-CN.md
@@ -69,8 +69,9 @@ bun run release -- \
执行
`bun run publish:stores -- --release vX.Y.Z --platform android --android-track production`,
再重新执行原发布命令续跑。当审计范围内包含 iOS 运行时变化时,同一条命令
- 会在 GitHub 公开发布之后启动 Xcode Cloud 并提交 App Review。iOS 失败不会
- 把已经公开的 GitHub Release 恢复为 Draft;用
+ 会在 GitHub 公开发布之后启动 Xcode Cloud 并提交 App Review。发布后审计
+ 通过后,脚本会关闭跟踪 Issue,然后再等待 App Store 投递。iOS 失败时,
+ GitHub Release 保持已发布,跟踪 Issue 保持已关闭;用
`bun run publish:stores -- --release vX.Y.Z --platform ios` 重试即可。详见
[移动端商店交付](store-delivery.zh-CN.md)。
- 重建后的桌面资产上传到 Draft 后,本地发布命令只签署
@@ -96,4 +97,6 @@ GitHub 官方仓库必须配置 `CNB_TCR_BUILD_PUSH_TOKEN` Actions Secret,该
Release。
- 发布后的原生资产或 GHCR 镜像审计失败时,脚本会尝试将 Release 恢复为
Draft,并保留 Issue。
+- 这些审计通过后,脚本会先关闭跟踪 Issue,再等待 App Store 投递。之后的
+ App Store 失败会让该 Issue 维持关闭。
- 显式安装时若替换应用失败,脚本会尽可能从 macOS 废纸篓备份恢复上一版应用。
diff --git a/scripts/release.mjs b/scripts/release.mjs
index 8f6fb92f..89b6f749 100644
--- a/scripts/release.mjs
+++ b/scripts/release.mjs
@@ -1856,23 +1856,7 @@ const releaseMain = async (options) => {
throw error;
}
- if (iosPlan.rebuild) {
- try {
- await waitForRun({
- repository: options.repository,
- runId: checkpoint.iosStoreRunId,
- label: "App Store delivery",
- });
- } catch (error) {
- console.error(
- "[release] GitHub Release is published; App Store delivery failed and must be retried with bun run publish:stores -- --release "
- + `${tag} --platform ios`,
- );
- throw error;
- }
- }
-
- run("gh", [
+ const releaseComment = run("gh", [
"issue",
"comment",
String(issueNumber),
@@ -1880,7 +1864,10 @@ const releaseMain = async (options) => {
options.repository,
"--body",
`Released in [${tag}](${releaseUrl}).\n\nRequired local validations, Draft asset and image preparation, and post-publication audits passed.`,
- ]);
+ ], { allowFailure: true });
+ if (releaseComment.status !== 0) {
+ console.warn(`[release] failed to comment on Issue #${issueNumber} before closing it`);
+ }
const timingStoreRunId =
checkpoint.storeRecoveryRunId ??
checkpoint.storeRunId ??
@@ -1937,6 +1924,24 @@ const releaseMain = async (options) => {
"--reason",
"completed",
]);
+ console.log(`[release] closed Issue #${issueNumber}`);
+
+ if (iosPlan.rebuild) {
+ try {
+ await waitForRun({
+ repository: options.repository,
+ runId: checkpoint.iosStoreRunId,
+ label: "App Store delivery",
+ });
+ } catch (error) {
+ console.error(
+ `[release] GitHub Release is published and Issue #${issueNumber} is closed; App Store delivery failed and must be retried with bun run publish:stores -- --release `
+ + `${tag} --platform ios`,
+ );
+ throw error;
+ }
+ }
+
console.log(`[release] ${tag} is complete; Demo deployment is not blocking completion`);
if (options.installDesktop) {
diff --git a/scripts/release.test.mjs b/scripts/release.test.mjs
index 78034200..10ef74bb 100644
--- a/scripts/release.test.mjs
+++ b/scripts/release.test.mjs
@@ -104,12 +104,16 @@ describe("release automation", () => {
const publication = releaseSource.indexOf('"--draft=false"');
const iosWait = releaseSource.indexOf('label: "App Store delivery"');
const restoreDraft = releaseSource.lastIndexOf('"--draft=true"');
+ const issueClose = releaseSource.indexOf('"issue",\n "close"', publication);
expect(iosPlan).toBeGreaterThan(0);
expect(iosDispatch).toBeGreaterThan(iosPlan);
expect(iosDispatch).toBeLessThan(publication);
expect(iosWait).toBeGreaterThan(publication);
expect(iosWait).toBeGreaterThan(restoreDraft);
+ expect(issueClose).toBeGreaterThan(restoreDraft);
+ expect(issueClose).toBeLessThan(iosWait);
+ expect(releaseSource).toContain("is closed; App Store delivery failed");
expect(releaseSource).toContain('platform: "ios"');
expect(releaseSource).toContain("iosRebuild: iosPlan.rebuild");
expect(releaseSource).toContain("updateIosMarketingVersion");