Enable isolated Capsule Local automatic update testing
This commit is contained in:
@ -4,10 +4,13 @@ import { createBuildConfig } from '../build/config.mjs'
|
||||
import { writeReleaseManifest } from './releaseArtifacts.mjs'
|
||||
|
||||
const args = process.argv.slice(2)
|
||||
if (args.some((arg) => !['--release', '--dir'].includes(arg))) {
|
||||
throw new Error('Usage: node scripts/package.mjs [--release] [--dir]')
|
||||
if (args.some((arg) => !['--release', '--dir', '--test-updates', '--bootstrap'].includes(arg))) {
|
||||
throw new Error('Usage: node scripts/package.mjs [--release | --test-updates [--bootstrap]] [--dir]')
|
||||
}
|
||||
const release = args.includes('--release')
|
||||
const testUpdates = args.includes('--test-updates')
|
||||
const bootstrap = args.includes('--bootstrap')
|
||||
if (testUpdates && args.includes('--dir')) throw new Error('Test update builds must produce an installer.')
|
||||
if (release && args.includes('--dir')) throw new Error('Release builds must produce an installer.')
|
||||
// Never let a failed rebuild leave an older directory looking publishable.
|
||||
if (release) {
|
||||
@ -15,12 +18,13 @@ if (release) {
|
||||
} else {
|
||||
process.env.CSC_IDENTITY_AUTO_DISCOVERY = 'false'
|
||||
}
|
||||
const config = createBuildConfig({ release })
|
||||
const config = createBuildConfig({ release, testUpdates, bootstrap })
|
||||
if (testUpdates) await rm(`${config.directories.output}/release-ready.json`, { force: true })
|
||||
await build({
|
||||
config,
|
||||
targets: Platform.WINDOWS.createTarget(args.includes('--dir') ? ['dir'] : ['nsis'], Arch.x64),
|
||||
publish: 'never'
|
||||
})
|
||||
if (release) {
|
||||
if (release || testUpdates) {
|
||||
await writeReleaseManifest(config.directories.output, config.publish[0].url)
|
||||
}
|
||||
|
||||
@ -2,8 +2,13 @@ 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')
|
||||
if (args.some((arg) => !['--upload', '--test-updates'].includes(arg))) throw new Error('Usage: npm run publish:release -- [--test-updates] [--upload]')
|
||||
const testing = args.includes('--test-updates')
|
||||
const release = await verifyRelease(testing ? 'dist/test' : 'dist/release')
|
||||
if (testing && (!new URL(release.feedUrl).pathname.endsWith('/capsule/testfeed/') ||
|
||||
(args.includes('--upload') && !new URL(process.env.CAPSULE_UPLOAD_URL).pathname.endsWith('/capsule/testupload/')))) {
|
||||
throw new Error('Test publication requires the separate testfeed and testupload endpoints.')
|
||||
}
|
||||
console.log(`Capsule ${release.version}: ${release.feedUrl}`)
|
||||
if (!args.includes('--upload')) {
|
||||
console.log('Verified. Upload order:')
|
||||
|
||||
Reference in New Issue
Block a user