16 lines
866 B
JavaScript
16 lines
866 B
JavaScript
import { verifyRelease } from './releaseArtifacts.mjs'
|
|
import { uploadRelease } from './uploadRelease.mjs'
|
|
|
|
const args = process.argv.slice(2)
|
|
if (args.some((arg) => arg !== '--upload')) throw new Error('Usage: npm run publish:release -- [--upload]')
|
|
const release = await verifyRelease('dist/release')
|
|
console.log(`Capsule ${release.version}: ${release.feedUrl}`)
|
|
if (!args.includes('--upload')) {
|
|
console.log('Verified. Upload order:')
|
|
for (const file of release.files) console.log(` ${file.name} (${file.data.length} bytes)`)
|
|
console.log('No files uploaded. Add --upload with CAPSULE_UPLOAD_URL and CAPSULE_UPLOAD_TOKEN to publish.')
|
|
} else {
|
|
// This adapter targets an authenticated HTTPS PUT/WebDAV endpoint, not any TTP site API.
|
|
await uploadRelease(release, { uploadUrl: process.env.CAPSULE_UPLOAD_URL, token: process.env.CAPSULE_UPLOAD_TOKEN })
|
|
}
|