Some checks failed
farmcontrol/farmcontrol-ui/pipeline/head There was a failure building this commit
80 lines
2.4 KiB
Groovy
80 lines
2.4 KiB
Groovy
def deploy() {
|
|
node('ubuntu') {
|
|
try {
|
|
stage('Deploy (Ubuntu)') {
|
|
checkout scm
|
|
nodejs(nodeJSInstallationName: 'Node23') {
|
|
sh 'yarn install --frozen-lockfile --production=false'
|
|
sh 'NODE_ENV=production yarn build'
|
|
// Deploy to Cloudflare Pages using wrangler
|
|
withCredentials([string(credentialsId: 'cloudflare-api-token', variable: 'CLOUDFLARE_API_TOKEN')]) {
|
|
sh 'yarn wrangler pages deploy build'
|
|
}
|
|
}
|
|
}
|
|
} finally {
|
|
cleanWs()
|
|
}
|
|
}
|
|
}
|
|
|
|
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 'yarn -v'
|
|
} else {
|
|
bat 'node -v'
|
|
bat 'yarn -v'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage("Install Dependencies (${label})") {
|
|
nodejs(nodeJSInstallationName: 'Node23') {
|
|
if (isUnix()) {
|
|
sh 'yarn install --frozen-lockfile --production=false'
|
|
} else {
|
|
bat 'yarn 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', fingerprint: true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
try {
|
|
parallel(
|
|
'Windows Build': buildOnLabel('windows', 'yarn build:electron'),
|
|
'MacOS Build': buildOnLabel('macos', 'yarn build:electron'),
|
|
'Ubuntu Deploy': { deploy() }
|
|
)
|
|
|
|
echo 'All parallel stages completed successfully!'
|
|
|
|
} catch (Exception e) {
|
|
echo "Pipeline failed: ${e.message}"
|
|
throw e
|
|
}
|