pipeline { agent any environment{ JWT_SECRET=credentials('JWT_SECRET') DATABASE_URL=credentials('DATABASE_URL') } stages{ stage('build'){ steps{ sh 'echo "JWT_SECRET=${JWT_SECRET}" | cat >> .env' sh 'echo "DATABASE_URL=${DATABASE_URL}" | cat >> .env' sh 'npm install' sh 'npm run build' } } stage('test'){ steps{ sh 'npx playwright install' sh 'npx playwright test' sh 'rm -r pack' } } stage('deploy'){ steps{ sshPublisher(publishers: [sshPublisherDesc(configName: 'Demos', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'ssh-uploads/subman/upgrade.sh', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: 'ssh-uploads/subman/', remoteDirectorySDF: false, removePrefix: '', sourceFiles: 'subman.tar.gz')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)]) } } } post { // Clean after build always { cleanWs(cleanWhenNotBuilt: true, deleteDirs: true, disableDeferredWipeout: true, // notFailBuild: true, cleanWhenSuccess:false, patterns: [[pattern: '**/*', type: 'INCLUDE'], [pattern: '.propsfile', type: 'EXCLUDE']]) } } }