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): read published release assets by id

tianma-if201f2c188778
diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml
index 799c5723..0600e194 100644
--- a/.github/workflows/desktop-build.yml
+++ b/.github/workflows/desktop-build.yml
@@ -78,11 +78,11 @@ jobs:
test "$expected_version" = "$root_version"
fi
+ # `gh release view --json assets` stays empty after a draft is published.
+ # The API URL is addressed by release id and still lists the uploads.
+ release_api="$(gh release view "$CURRENT_TAG" --repo "$GITHUB_REPOSITORY" --json apiUrl --jq .apiUrl)"
mapfile -t current_assets < <(
- gh release view "$CURRENT_TAG" \
- --repo "$GITHUB_REPOSITORY" \
- --json assets \
- --jq '.assets[].name'
+ gh api "$release_api" --jq '.assets[].name'
)
asset_ready="$(
printf '%s\n' "${current_assets[@]}" |
diff --git a/.github/workflows/mobile-build.yml b/.github/workflows/mobile-build.yml
index eba55d3d..65f2b627 100644
--- a/.github/workflows/mobile-build.yml
+++ b/.github/workflows/mobile-build.yml
@@ -116,11 +116,11 @@ jobs:
fi
fi
+ # `gh release view --json assets` stays empty after a draft is published.
+ # The API URL is addressed by release id and still lists the uploads.
+ release_api="$(gh release view "$CURRENT_TAG" --repo "$GITHUB_REPOSITORY" --json apiUrl --jq .apiUrl)"
mapfile -t current_assets < <(
- gh release view "$CURRENT_TAG" \
- --repo "$GITHUB_REPOSITORY" \
- --json assets \
- --jq '.assets[].name'
+ gh api "$release_api" --jq '.assets[].name'
)
asset_ready="$(
printf '%s\n' "${current_assets[@]}" |
diff --git a/docs/release.md b/docs/release.md
index 37ebf1c5..5fafacb4 100644
--- a/docs/release.md
+++ b/docs/release.md
@@ -87,6 +87,10 @@ actually needed.
Issue closed; retry with
`bun run publish:stores -- --release vX.Y.Z --platform ios`. See
[Mobile Store Delivery](store-delivery.md).
+- Published desktop and Android audits read asset names from the release API
+ URL. `gh release view --json assets` can stay empty after a draft is
+ published, and treating that empty list as a missing asset set returns the
+ Release to Draft.
- After rebuilt desktop assets are uploaded to the Draft, the local release
command signs only `latest-windows.json`; the private key never enters GitHub
Actions. A second desktop workflow run downloads the Windows installer,
diff --git a/docs/release.zh-CN.md b/docs/release.zh-CN.md
index c370b212..8ce442cd 100644
--- a/docs/release.zh-CN.md
+++ b/docs/release.zh-CN.md
@@ -74,6 +74,9 @@ bun run release -- \
GitHub Release 保持已发布,跟踪 Issue 保持已关闭;用
`bun run publish:stores -- --release vX.Y.Z --platform ios` 重试即可。详见
[移动端商店交付](store-delivery.zh-CN.md)。
+- 公开发布后的桌面和 Android 审计通过 Release API URL 读取资产文件名。
+ Draft 刚公开时,`gh release view --json assets` 可能持续返回空列表;如果把
+ 这个空列表当成资产缺失,发布会被退回 Draft。
- 重建后的桌面资产上传到 Draft 后,本地发布命令只签署
`latest-windows.json`,私钥不会进入 GitHub Actions。第二次桌面工作流会重新
下载 Windows 安装包、`latest.yml`、清单、签名和校验和文件并独立审计,通过后
diff --git a/scripts/desktop-build-workflow.test.mjs b/scripts/desktop-build-workflow.test.mjs
index 13227c8a..aca511a7 100644
--- a/scripts/desktop-build-workflow.test.mjs
+++ b/scripts/desktop-build-workflow.test.mjs
@@ -45,8 +45,10 @@ describe("desktop release workflow", () => {
const releasePlan = mobileWorkflow.indexOf(" - name: Compare with previous formal release");
expect(regressionTests).toBeGreaterThanOrEqual(0);
expect(regressionTests).toBeLessThan(releasePlan);
- expect(workflow).toContain('gh release view "$CURRENT_TAG"');
- expect(mobileWorkflow).toContain('gh release view "$CURRENT_TAG"');
+ expect(workflow).toContain('gh release view "$CURRENT_TAG" --repo "$GITHUB_REPOSITORY" --json apiUrl --jq .apiUrl');
+ expect(mobileWorkflow).toContain('gh release view "$CURRENT_TAG" --repo "$GITHUB_REPOSITORY" --json apiUrl --jq .apiUrl');
+ expect(workflow).toContain("gh api \"$release_api\" --jq '.assets[].name'");
+ expect(mobileWorkflow).toContain("gh api \"$release_api\" --jq '.assets[].name'");
expect(workflow).not.toContain('releases/tags/${CURRENT_TAG}');
expect(mobileWorkflow).not.toContain('releases/tags/${CURRENT_TAG}');
});