Review found that `apps/desktop/README.md#release-versions` and the 2026-09-16 version-derivation note already specify this convention, and that three of their requirements were reversed without saying so. The rules themselves are right; what was wrong was leaving them undocumented and rejecting one of the forms they prescribe. A stable base takes `-test.YYYYMMDD.index`, which validation refused because such a version ranks below its base. That ordering is the point: the form belongs to a test feed that never serves the production release. Both READMEs, the older note, and a new note now record which requirements this change reverses and why. Three defects the review found, each reproducible: - `afterPack` compared the bundled runtime against the product version, which broke installed-update qualification: that flow passes a runtime whose version was deliberately rewritten. The expected version is now a parameter the preparer supplies, and `verifyDesktopRuntime` says "bundled X is not the expected Y" rather than naming Electron. - Upload could only learn the published version from a shell variable, conflicting with "release fields come only from the target file". It reads the completion record packaging wrote, and a mismatch now prints the version that record holds. - Automatic numbering read one listing page and one fixed directory. It now follows every page, discards a listing it could not finish rather than reusing an index that would overwrite a published installer, bounds the request through the client's own timeout, and reads the directory an unsigned build actually writes. Also: `npm run` and `yarn run` set `npm_execpath` too, so the pnpm resolution checks the path names pnpm; the argument separator can arrive after a run script's preset arguments, not only first; and the toolchain probe, parser, build commit, and tarball readers now have specs.
40 lines
2.6 KiB
TypeScript
40 lines
2.6 KiB
TypeScript
/** Select isolated qualification inputs without weakening the ordinary Windows installer or signing hooks. */
|
|
import { join } from 'node:path'
|
|
import { createElectronBuilderConfig } from './electron-builder-config.mjs'
|
|
import { readInstalledUpdateRun } from './installed-update-qualification.ts'
|
|
import { verifyInstalledUpdateApplication } from './prepare-installed-update-application.ts'
|
|
import { verifyDesktopRuntime } from '../src/runtime-tree.ts'
|
|
|
|
/**
|
|
* Validate one version and construct its signed-only, test-only builder configuration.
|
|
* @param manifest Original run.json with prepared runtime and application files.
|
|
* @param version One of the run's two versions.
|
|
* @param environment File-owned .env.windows settings loaded by a supervised caller; never logged here.
|
|
* @returns Configuration only. Calling builder hooks requires separate hardware authorization and supervision.
|
|
*/
|
|
export async function createInstalledUpdateBuilderConfig(manifest: string, version: string, environment: NodeJS.ProcessEnv) {
|
|
const run = await readInstalledUpdateRun(manifest)
|
|
if (!run.versions.includes(version)) throw new Error('installed update: package version is outside the qualification run')
|
|
if (environment.DSH_DESKTOP_AUTO_UPDATE_ENV !== 'test' || environment.DSH_DESKTOP_UNSIGNED === '1'
|
|
|| environment.DOWNLOAD_TEST_ORIGIN !== run.origin || environment.DOWNLOAD_TEST_COS_BUCKET !== run.bucket) {
|
|
throw new Error('installed update: signed ordinary-update qualification requires matching test deployment settings')
|
|
}
|
|
const application = await verifyInstalledUpdateApplication(run.root)
|
|
const dsh = join(run.root, version, 'dsh')
|
|
await verifyDesktopRuntime(dsh, version, { platform: 'win32', arch: 'x64' })
|
|
const config = createElectronBuilderConfig({ ...environment, DSH_DESKTOP_APP_ID: run.appId,
|
|
DSH_DESKTOP_TARGET_PLATFORM: 'win32', DSH_DESKTOP_TARGET_ARCH: 'x64', DSH_DESKTOP_UNSIGNED: '0' }, 'win32', 'x64', dsh, version)
|
|
return { ...config,
|
|
productName: run.productName,
|
|
directories: { ...config.directories, output: join(run.root, version, 'installer') },
|
|
extraMetadata: { ...config.extraMetadata, name: `dsh-update-test-${run.id}`, version, main: 'qualification-bootstrap.mjs' },
|
|
files: [
|
|
{ from: application, to: '.', filter: ['lib/*.js', 'lib/*.cjs', 'renderer/**/*', 'qualification-bootstrap.mjs', 'installed-update-identity.mjs'] },
|
|
'package.json',
|
|
{ from: dsh, to: 'dsh', filter: ['**/*'] },
|
|
{ from: join(dsh, 'node_modules'), to: 'dsh/node_modules', filter: ['**/*'] },
|
|
],
|
|
publish: [{ provider: 'generic' as const, url: `${run.origin}/${run.feedKey.slice(0, -'nightly.yml'.length)}`, channel: 'nightly' }],
|
|
}
|
|
}
|