diff --git a/www/tools/deploy.mjs b/www/tools/deploy.mjs index 22a433b..5d913b0 100644 --- a/www/tools/deploy.mjs +++ b/www/tools/deploy.mjs @@ -134,14 +134,22 @@ async function createSourceSnapshot(directory, sourceCommit) { await fs.rm(archive); return { snapshot, included: included.length, excluded }; } -async function executeBuild(env) { - run('npm', ['run', 'check'], { env }); - run('node', ['--experimental-strip-types', '--test', 'tools/jotform-form-a.test.mjs', 'tools/service-portal.test.mjs', 'tools/phase10-artifact.test.mjs'], { env }); - run('npm', ['run', 'test:publication'], { env }); - run('npm', ['run', 'audit:links'], { env }); - run('npm', ['run', 'audit:images'], { env }); - run('npm', ['run', 'audit:blog'], { env }); - run('npm', ['run', 'build'], { env }); +function validationEnvironment() { + const env = { ...process.env }; + // Regression fixtures build their own publication modes. Do not let the + // production-only portal payload gate leak into those isolated builds. + for (const name of ['AIA_PORTAL_LOCAL_PREVIEW_APPROVED', 'AIA_PORTAL_PRODUCTION_APPROVED', 'AIA_PORTAL_CIPHERTEXT_FILE', 'AIA_PORTAL_PRODUCTION_CIPHERTEXT_FILE']) delete env[name]; + return env; +} +async function executeBuild(buildEnv) { + const testEnv = validationEnvironment(); + run('npm', ['run', 'check'], { env: testEnv }); + run('node', ['--experimental-strip-types', '--test', 'tools/jotform-form-a.test.mjs', 'tools/service-portal.test.mjs', 'tools/phase10-artifact.test.mjs'], { env: testEnv }); + run('npm', ['run', 'test:publication'], { env: testEnv }); + run('npm', ['run', 'audit:links'], { env: testEnv }); + run('npm', ['run', 'audit:images'], { env: testEnv }); + run('npm', ['run', 'audit:blog'], { env: buildEnv }); + run('npm', ['run', 'build'], { env: buildEnv }); } function parseArgs(argv) { const allowed = new Set(['--dry-run', '--confirm']);