Fixed deploy stage.
Some checks failed
farmcontrol/farmcontrol-ui/pipeline/head There was a failure building this commit

This commit is contained in:
Tom Butcher 2025-12-28 17:47:00 +00:00
parent e74d88d286
commit 375e32a356

13
Jenkinsfile vendored
View File

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