You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

22 lines
1.4 KiB

import { readFileSync } from 'node:fs'
const brand = JSON.parse(readFileSync(new URL('../app.config.json', import.meta.url), 'utf8'))
const manifest = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'))
function endpoint(value, name) {
if (!value) throw new Error(name + ' must be configured before release')
const url = new URL(value)
if (url.protocol !== 'https:' || url.username || url.password || url.search || url.hash)
throw new Error(name + ' must use HTTPS without credentials, query or fragment')
}
endpoint(brand.updateUrl, 'updateUrl')
endpoint(brand.diagnosticsUrl, 'diagnosticsUrl')
if (!/^\d+\.\d+\.\d+$/.test(manifest.version))
throw new Error('Stable releases require an x.y.z version')
if (brand.appId === 'dev.workshop.electron' || brand.name === 'electron-template')
throw new Error('Rename the template identity before release; keep it stable for all upgrades')
if (process.env.RELEASE_TAG && process.env.RELEASE_TAG !== 'v' + manifest.version)
throw new Error('Release tag must match package.json version')
if (['win32', 'darwin'].includes(process.platform) && !process.env.CSC_LINK)
throw new Error('Release signing certificate CSC_LINK is required')
if (process.platform === 'darwin' && !process.env.APPLE_API_KEY && !process.env.APPLE_ID)
throw new Error('macOS release requires notarization credentials')
console.log('Release identity, version, destinations and signing configuration checked')