This commit is contained in:
曾志威
2026-09-24 14:20:28 +08:00
parent 351129500a
commit e5573354cd
4 changed files with 15 additions and 5 deletions
+4 -3
View File
@@ -221,12 +221,13 @@ if (process.argv[1] && pathToFileURL(resolve(process.argv[1])).href === import.m
const result = uploadRelease(resolveProjectPath(process.argv[3] || 'bin/releases/ci'), process.env.IPFS_API, process.env.IPFS_TOKEN);
const gateway = new URL(process.env.IPFS_API).origin;
console.log(`IPFS index directory CID (pin requested): ${result.cid}`);
console.log(`Download page: ${gateway}/ipfs/${result.cid}/`);
for (const entry of result.files) console.log(entry.uri);
console.log('\n=== IPFS upload complete: download URLs ===');
console.log(`Download page:\n${gateway}/ipfs/${result.cid}/`);
for (const entry of result.files) {
const download = new URL(`${gateway}/ipfs/${entry.uri.slice('ipfs://'.length)}`);
if (entry.cid) download.searchParams.set('filename', entry.file);
console.log(`Download ${entry.file}: ${download.href}`);
console.log(entry.uri);
console.log(`\nDownload ${entry.file}:\n${download.href}`);
}
} else {
throw new Error('Usage: node scripts/ci-release.mjs package [binary-directory] [output-directory] | upload [release-directory]');
+5 -2
View File
@@ -181,7 +181,10 @@ test('four add requests pin three archives and an index directory without changi
for (const part of parts.slice(2)) assert.equal(part.body, readFileSync(join(output, part.file), 'utf8'));
assert.equal(result.stdout.includes(token) || result.stderr.includes(token), false);
assert(result.stdout.includes(`IPFS index directory CID (pin requested): ${directoryCid}`));
assert(result.stdout.includes(`Download page: ${new URL(server.api).origin}/ipfs/${directoryCid}/`));
assert(result.stdout.includes(`Download page:\n${new URL(server.api).origin}/ipfs/${directoryCid}/`));
const summary = result.stdout.split('=== IPFS upload complete: download URLs ===')[1];
assert(summary && !summary.includes('ipfs://'));
assert.equal(summary.split('\n').filter(line => /^https?:\/\//.test(line)).length, 8);
for (const [offset, entry] of manifest.packages.entries()) {
assert(result.stdout.includes(`Uploading IPFS archive ${offset + 1}/${targets.length}: ${entry.file}`));
}
@@ -193,7 +196,7 @@ test('four add requests pin three archives and an index directory without changi
for (const entry of receipt.files) {
const download = new URL(`${new URL(server.api).origin}/ipfs/${entry.uri.slice('ipfs://'.length)}`);
if (entry.cid) download.searchParams.set('filename', entry.file);
assert(result.stdout.includes(`Download ${entry.file}: ${download.href}`));
assert(summary.includes(`Download ${entry.file}:\n${download.href}`));
assert(result.stdout.includes(entry.uri));
}
assert(!JSON.stringify(receipt).includes(token));