farmcontrol-server/Jenkinsfile
Tom Butcher bc91c2330f
Some checks are pending
farmcontrol/farmcontrol-server/pipeline/head Build started...
Switched to pnpm.
2026-02-01 22:31:15 +00:00

60 lines
1.9 KiB
Groovy

def buildOnLabel(label, buildCommand) {
return {
node(label) {
stage("Checkout (${label})") {
checkout scm
}
stage("Setup Node.js (${label})") {
nodejs(nodeJSInstallationName: 'Node23') {
if (isUnix()) {
sh 'node -v'
sh 'pnpm -v'
} else {
bat 'node -v'
bat 'pnpm -v'
}
}
}
stage("Install Dependencies (${label})") {
nodejs(nodeJSInstallationName: 'Node23') {
if (isUnix()) {
sh 'pnpm install --frozen-lockfile --production=false'
} else {
bat 'pnpm install --frozen-lockfile --production=false'
}
}
}
stage("Build (${label})") {
nodejs(nodeJSInstallationName: 'Node23') {
if (isUnix()) {
sh "NODE_ENV=production ${buildCommand}"
} else {
bat "set NODE_ENV=production && ${buildCommand}"
}
}
}
stage("Archive Artifacts (${label})") {
archiveArtifacts artifacts: 'app_dist/**/*.dmg, app_dist/**/*.exe, app_dist/**/*.AppImage, app_dist/**/*.deb, app_dist/**/*.rpm', fingerprint: true
}
}
}
}
try {
parallel(
'Windows Build': buildOnLabel('windows', 'pnpm build:electron'),
'MacOS Build': buildOnLabel('macos', 'pnpm build:electron'),
'Linux Build': buildOnLabel('ubuntu', 'pnpm build:linux')
)
echo 'All parallel stages completed successfully!'
} catch (Exception e) {
echo "Pipeline failed: ${e.message}"
throw e
}