ci: upload tagged Linux runtimes to draft releases (#16)

Co-authored-by: alvinfei <alvinfei@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
authored and GitHub committed 2026-10-17 01:51:58 +08:00
1 parent 842fbe6044
commit 9ba602ffd2
3 files changed
+91 -2

No files matched your search

+62
View File
@@ -102,3 +102,65 @@ jobs:
if-no-files-found: error
compression-level: 0
retention-days: 14
publish-draft-release:
if: ${{ inputs.run_lifecycle && startsWith(github.ref, 'refs/tags/v') }}
needs: matrix
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
persist-credentials: false
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
pattern: memhub-runtime-linux-*
path: memhub/release-assets
merge-multiple: true
- name: Verify tag and Linux release assets
shell: bash
run: |
set -euo pipefail
version=$(node -p 'require("./package.json").version')
node scripts/verify-release-version.mjs \
--channel stable \
--version "$version" \
--build-number "$(node -p 'require("./package.json").release.build_number')" \
--tag "$GITHUB_REF_NAME"
for arch in x64 arm64; do
archive="release-assets/memhub-runtime-v${version}-linux-${arch}.tar.gz"
test -f "$archive"
test -f "$archive.sha256"
(
cd release-assets
sha256sum -c "$(basename "$archive.sha256")"
)
done
- name: Upload Linux assets to a draft GitHub Release
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
set -euo pipefail
if gh release view "$GITHUB_REF_NAME" \
--repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
test "$(
gh release view "$GITHUB_REF_NAME" \
--repo "$GITHUB_REPOSITORY" \
--json isDraft \
--jq .isDraft
)" = "true"
else
gh release create "$GITHUB_REF_NAME" \
--repo "$GITHUB_REPOSITORY" \
--verify-tag \
--draft \
--generate-notes \
--title "$GITHUB_REF_NAME"
fi
gh release upload "$GITHUB_REF_NAME" \
release-assets/memhub-runtime-v*-linux-*.tar.gz \
release-assets/memhub-runtime-v*-linux-*.tar.gz.sha256 \
--repo "$GITHUB_REPOSITORY" \
--clobber
+4 -2
View File
@@ -12,8 +12,10 @@ MemHub `v1.0.1`(build 5)的发行目标如下:
正式支持以对应 GitHub Release 的 `release-manifest.json` 为准。Manifest 记录版本、
build、Git commit、协议范围、文件大小和 SHA-256;缺少条目的平台不属于该版本支持范围。
Linux Runtime 可通过仓库的 `Linux lifecycle` GitHub Actions 手动构建和下载。macOS
制品由发行流水线完成签名与公证后上传;GitHub 不保存 Apple 私钥。
在 `v*` tag 上手动运行仓库的 `Linux lifecycle` GitHub Actions 后,Linux Runtime
和 SHA-256 文件会自动上传到对应的 Draft Release;普通分支运行只保留 Actions
Artifact。macOS 制品由发行流水线完成签名与公证后上传到同一个 Draft Release;
GitHub 不保存 Apple 私钥。所有平台制品核对完成后再发布 Release。
最低支持 macOS 13。当前更新方式是从 GitHub Releases 手动下载新版本,不包含
auto-updater。
@@ -97,4 +97,29 @@ describe("Linux runtime scripts", () => {
assert.match(script, /cleanup-uninstall/);
assert.doesNotMatch(script, /install:\s*["']blocked["']/);
});
it("uploads successful tagged builds only to a draft release", async () => {
const workflow = await readFile(
path.join(directory, "../../../../.github/workflows/linux-lifecycle.yml"),
"utf8",
);
assert.match(
workflow,
/publish-draft-release:[\s\S]*startsWith\(github\.ref, 'refs\/tags\/v'\)/,
);
assert.match(
workflow,
/publish-draft-release:[\s\S]*permissions:\s*\n\s*contents: write/,
);
assert.match(workflow, /actions\/download-artifact@[a-f0-9]{40}/);
assert.match(
workflow,
/verify-release-version\.mjs[\s\S]*--channel stable/,
);
assert.match(workflow, /sha256sum -c/);
assert.match(workflow, /--json isDraft[\s\S]*--jq \.isDraft/);
assert.match(workflow, /gh release create[\s\S]*--draft/);
assert.match(workflow, /gh release upload[\s\S]*--clobber/);
});
});