diff --git a/Jenkinsfile b/Jenkinsfile index ee553e1..2e83818 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,54 +20,44 @@ def deploy() { def buildOnLabel(label, buildCommand) { return { node(label) { - try { - stage("Checkout (${label})") { - checkout scm - } + 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}" - sh 'ls -la build || echo "Build directory not found"' - } else { - bat "set NODE_ENV=production && ${buildCommand}" - bat 'if not exist build echo "Build directory not found"' - } - } - } - - stage("Verify Build (${label})") { + stage("Setup Node.js (${label})") { + nodejs(nodeJSInstallationName: 'Node23') { if (isUnix()) { - sh 'test -d build || (echo "Build directory does not exist" && exit 1)' + sh 'node -v' + sh 'yarn -v' } else { - bat 'if not exist build (echo "Build directory does not exist" && exit 1)' + bat 'node -v' + bat 'yarn -v' } } - } finally { - cleanWs() + } + + 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 } } }