pipeline { agent { label 'windows' } options { timestamps() disableConcurrentBuilds() timeout(time: 30, unit: 'MINUTES') } triggers { pollSCM('') } stages { stage('Checkout') { steps { checkout scm } } stage('Build') { parallel { stage('Build Debug') { steps { echo 'Building Debug...' bat """ "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" ^ "%WORKSPACE%\\KhaoticEngineReborn.sln" ^ /p:Configuration=Debug ^ /p:Platform=x64 ^ /m ^ /verbosity:minimal """ } } stage('Build Release') { steps { echo 'Building Release...' bat """ "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" ^ "%WORKSPACE%\\KhaoticEngineReborn.sln" ^ /p:Configuration=Release ^ /p:Platform=x64 ^ /m ^ /verbosity:minimal """ } } } } stage('Package') { parallel { stage('Package Debug') { steps { echo 'Packaging Debug into ZIP' bat 'if not exist "%WORKSPACE%\\builds" mkdir "%WORKSPACE%\\builds"' bat """ powershell -Command "Compress-Archive -Path '%WORKSPACE%\\**\\Debug\\*' -DestinationPath '%WORKSPACE%\\builds\\KhaoticEngineReborn_Debug.zip' -Force" """ } } stage('Package Release') { steps { echo 'Packaging Release into ZIP' bat 'if not exist "%WORKSPACE%\\builds" mkdir "%WORKSPACE%\\builds"' bat """ powershell -Command "Compress-Archive -Path '%WORKSPACE%\\**\\Release\\*' -DestinationPath '%WORKSPACE%\\builds\\KhaoticEngineReborn_Release.zip' -Force" """ } } } } stage('Archive Artifacts') { steps { archiveArtifacts artifacts: 'builds/*.zip', fingerprint: true } } } post { success { script { def debugUrl = "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Debug.zip" def releaseUrl = "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Release.zip" bat """ curl -X POST http://host.docker.internal:2500/ci-notify ^ -H "Content-Type: application/json" ^ -d "{\\"userId\\": \\"378262266723696651\\",\\"status\\": \\"success\\",\\"urls\\":[\\"${debugUrl}\\",\\"${releaseUrl}\\"]}" """ } } failure { script { bat """ curl -X POST http://host.docker.internal:2500/ci-notify ^ -H "Content-Type: application/json" ^ -d "{\\"userId\\": \\"378262266723696651\\",\\"status\\": \\"failure\\",\\"urls\\":[]}" """ } } always { cleanWs(deleteDirs: true, disableDeferredWipeout: true, notFailBuild: true) } } }