refactor(catalog): register focused Harmony plugins and accelerate mainland CI

This commit is contained in:
2026-09-11 10:37:01 +08:00
parent 5802042e10
commit 235cad0733
9 changed files with 86 additions and 32 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Source this file in a Linux job after checking out the catalog.
set -euo pipefail
export npm_config_registry="${NPM_REGISTRY:-https://registry.npmmirror.com}"
export COREPACK_NPM_REGISTRY="$npm_config_registry"
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
if ! command -v node >/dev/null || ! node -e 'process.exit(Number(process.versions.node.split(".")[0]) >= 22 ? 0 : 1)'; then
case "$(uname -m)" in
x86_64) node_arch=x64; node_sha=d60acfe00a2932254bb0ad20e01b0d74397a0875595de719654b214f4b03f307 ;;
aarch64|arm64) node_arch=arm64; node_sha=fff4078c5def658577f92c88db7db3bc0072924bfb93fe52c1e744a54e94abb8 ;;
*) echo 'Unsupported Linux runner architecture' >&2; exit 1 ;;
esac
node_archive="node-v22.23.2-linux-${node_arch}.tar.xz"
node_cache="${RUNNER_TEMP:-/tmp}/trove-node-22.23.2-${node_arch}"
mkdir -p "$node_cache"
curl --fail --location --retry 3 --connect-timeout 15 --max-time 180 \
"${NODE_MIRROR:-https://npmmirror.com/mirrors/node}/v22.23.2/$node_archive" -o "$node_cache/$node_archive"
# Hashes are pinned from the official nodejs.org SHASUMS256.txt.
printf '%s %s\n' "$node_sha" "$node_cache/$node_archive" | sha256sum --check --status
tar -xJf "$node_cache/$node_archive" -C "$node_cache" --strip-components=1
export PATH="$node_cache/bin:$PATH"
fi
node --version
# The catalog only needs semver; avoid downloading pnpm/Corepack in each job.
npm install --ignore-scripts --no-audit --no-fund --package-lock=false
+1 -1
View File
@@ -20,7 +20,7 @@ files.set('trove-release.json', descriptorBytes);
let release = await api(`${route}/releases/tags/${encodeURIComponent(tag)}`, { missing: true });
if (!release) release = await api(`${route}/releases`, { method: 'POST', body: {
tag_name: tag, target_commitish: descriptor.commit, name: tag, draft: true,
prerelease: config.suite ? false : tag.slice(1).split('+')[0].includes('-'),
prerelease: tag.slice(1).split('+')[0].includes('-'),
body: `${config.name} ${tag}\n\n通过 Trove 软件源安装和更新。`,
} });
for (const [name, bytes] of files) {
+1 -1
View File
@@ -16,7 +16,7 @@ export async function releasePlan(entriesFile, tag) {
for (const entry of entries) {
const manifest = entry.manifest;
if (!config.ids.includes(manifest.id) || !valid(manifest.version)) throw new Error('Unexpected plugin identity/version');
if (!config.suite && tag !== `v${manifest.version}`) throw new Error('Release tag must match curio.json');
if (tag !== `v${manifest.version}`) throw new Error('Release tag must match curio.json');
if (!['any', 'aarch64-apple-darwin', 'x86_64-apple-darwin'].includes(entry.artifact.target)) throw new Error('Unsupported package target');
const bytes = await readFile(entry.file);
if (digest(bytes) !== entry.artifact.sha256 || bytes.length !== entry.artifact.size) throw new Error('Package differs from build metadata');
+1 -1
View File
@@ -29,7 +29,7 @@ if (object?.type !== 'commit' || object.sha !== descriptor.commit) throw new Err
const additions = []; const identities = new Set();
for (const plugin of descriptor.plugins) {
if (!publisher.ids.includes(plugin.id) || !valid(plugin.version) || !validRange(plugin.engine?.trove) || typeof plugin.name !== 'string' || !plugin.name.trim()) throw new Error('Unexpected plugin identity or compatibility range');
if (!publisher.suite && tag !== `v${plugin.version}`) throw new Error('Plugin version differs from release tag');
if (tag !== `v${plugin.version}`) throw new Error('Plugin version differs from release tag');
if (!Array.isArray(plugin.artifacts) || !plugin.artifacts.length) throw new Error('Plugin has no artifacts');
for (const artifact of plugin.artifacts) {
if (!['any', 'aarch64-apple-darwin', 'x86_64-apple-darwin'].includes(artifact.target) || !/^[a-f0-9]{64}$/.test(artifact.sha256) || !Number.isSafeInteger(artifact.size) || artifact.size < 1 || artifact.size > 512 * 1024 * 1024) throw new Error('Invalid artifact metadata');