diff --git a/Jenkinsfile b/Jenkinsfile index f34d0e0..ee553e1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,8 +4,8 @@ def deploy() { stage('Deploy (Ubuntu)') { checkout scm nodejs(nodeJSInstallationName: 'Node23') { - sh 'yarn install --frozen-lockfile' - sh 'yarn build' + sh 'yarn install --frozen-lockfile --production=false' + sh 'NODE_ENV=production yarn build' // Deploy to Cloudflare Pages using wrangler // CLOUDFLARE_API_TOKEN should be set as a Jenkins credential/env variable sh 'npx wrangler pages deploy build' @@ -20,7 +20,6 @@ def deploy() { def buildOnLabel(label, buildCommand) { return { node(label) { - env.NODE_ENV = 'production' try { stage("Checkout (${label})") { checkout scm @@ -41,9 +40,9 @@ def buildOnLabel(label, buildCommand) { stage("Install Dependencies (${label})") { nodejs(nodeJSInstallationName: 'Node23') { if (isUnix()) { - sh 'yarn install --frozen-lockfile' + sh 'yarn install --frozen-lockfile --production=false' } else { - bat 'yarn install --frozen-lockfile' + bat 'yarn install --frozen-lockfile --production=false' } } } @@ -51,10 +50,10 @@ def buildOnLabel(label, buildCommand) { stage("Build (${label})") { nodejs(nodeJSInstallationName: 'Node23') { if (isUnix()) { - sh buildCommand + sh "NODE_ENV=production ${buildCommand}" sh 'ls -la build || echo "Build directory not found"' } else { - bat buildCommand + bat "set NODE_ENV=production && ${buildCommand}" bat 'if not exist build echo "Build directory not found"' } }