fix(desktop): use full Windows installers within the feed limit
This commit is contained in:
parent
52df7e7e7b
commit
df680e4716
17 changed files with 109 additions and 32 deletions
|
|
@ -23,11 +23,12 @@ async function fingerprint(directory, name) {
|
|||
return { name, size: info.size, sha256: hash.digest('hex') }
|
||||
}
|
||||
|
||||
export async function saveReleaseArtifacts(directory, { version, tagCommit, withRuntime }) {
|
||||
export async function saveReleaseArtifacts(directory, { version, tagCommit, withRuntime, differentialDownload = true }) {
|
||||
const names = await readdir(directory)
|
||||
const installers = names.filter((name) => /-Setup-.*\.exe$/.test(name))
|
||||
if (installers.length !== 1) throw new Error('Expected exactly one release installer')
|
||||
const files = [installers[0], `${installers[0]}.blockmap`, 'latest.yml']
|
||||
const files = [installers[0], 'latest.yml']
|
||||
if (differentialDownload) files.splice(1, 0, `${installers[0]}.blockmap`)
|
||||
if (withRuntime) {
|
||||
const portable = JSON.parse(await readFile(join(directory, 'portable.json'), 'utf8'))
|
||||
const runtime = JSON.parse(await readFile(join(directory, 'runtime', 'runtime.json'), 'utf8'))
|
||||
|
|
@ -40,7 +41,7 @@ export async function saveReleaseArtifacts(directory, { version, tagCommit, with
|
|||
}
|
||||
const artifacts = []
|
||||
for (const name of new Set(files)) artifacts.push(await fingerprint(directory, name))
|
||||
const checkpoint = { version, tagCommit, withRuntime, artifacts }
|
||||
const checkpoint = { version, tagCommit, withRuntime, differentialDownload, artifacts }
|
||||
const path = join(directory, CHECKPOINT)
|
||||
await writeFile(`${path}.tmp`, `${JSON.stringify(checkpoint, null, 2)}\n`)
|
||||
await rename(`${path}.tmp`, path)
|
||||
|
|
@ -51,7 +52,11 @@ export async function verifyReleaseArtifacts(directory, expected) {
|
|||
for (const field of ['version', 'tagCommit', 'withRuntime']) {
|
||||
if (checkpoint[field] !== expected[field]) throw new Error(`Release checkpoint ${field} mismatch`)
|
||||
}
|
||||
if (!Array.isArray(checkpoint.artifacts) || checkpoint.artifacts.length < 3) {
|
||||
if (expected.differentialDownload !== undefined && checkpoint.differentialDownload !== expected.differentialDownload) {
|
||||
throw new Error('Release checkpoint differentialDownload mismatch')
|
||||
}
|
||||
const minimumArtifacts = checkpoint.differentialDownload === false ? 2 : 3
|
||||
if (!Array.isArray(checkpoint.artifacts) || checkpoint.artifacts.length < minimumArtifacts) {
|
||||
throw new Error('Release checkpoint has no complete artifact set')
|
||||
}
|
||||
for (const entry of checkpoint.artifacts) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue