diff --git a/Jenkinsfile b/Jenkinsfile index 378e7be..d83038d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,8 +2,8 @@ pipeline { agent { label 'windows' } parameters { - string(name: 'DISCORD_USER_ID', defaultValue: '378262266723696651', description: 'ID Discord pour les DMs') - choice(name: 'BUILD_TYPE', choices: ['Both', 'Debug', 'Release'], description: 'Type de build à lancer') + string(name: 'DISCORD_USER_ID', defaultValue: '378262266723696651', description: 'ID Discord pour recevoir les DMs') + choice(name: 'BUILD_TYPE', choices: ['Both', 'Debug', 'Release'], description: 'Type de build à utiliser') } options { @@ -18,29 +18,38 @@ pipeline { stages { stage('Checkout') { - steps { checkout scm } + steps { + checkout scm + } } stage('Build') { - when { expression { params.BUILD_TYPE in ['Both','Debug','Release'] } } parallel { stage('Build Debug') { - when { expression { params.BUILD_TYPE in ['Both','Debug'] } } + when { expression { params.BUILD_TYPE in ['Both', '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 + /p:Configuration=Debug ^ + /p:Platform=x64 ^ + /m ^ + /verbosity:minimal """ } } stage('Build Release') { - when { expression { params.BUILD_TYPE in ['Both','Release'] } } + when { expression { params.BUILD_TYPE in ['Both', '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 + /p:Configuration=Release ^ + /p:Platform=x64 ^ + /m ^ + /verbosity:minimal """ } } @@ -50,28 +59,22 @@ pipeline { stage('Package') { parallel { stage('Package Debug') { - when { expression { params.BUILD_TYPE in ['Both','Debug'] } } + when { expression { params.BUILD_TYPE in ['Both', 'Debug'] } } steps { - powershell """ - if (-Not (Test-Path \"${env.WORKSPACE}\\builds\")) { - New-Item -ItemType Directory -Path \"${env.WORKSPACE}\\builds\" | Out-Null - } - Compress-Archive -Path \"${env.WORKSPACE}\\**\\Debug\\*\" ` - -DestinationPath \"${env.WORKSPACE}\\builds\\KhaoticEngineReborn_Debug.zip\" ` - -Force + 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') { - when { expression { params.BUILD_TYPE in ['Both','Release'] } } + when { expression { params.BUILD_TYPE in ['Both', 'Release'] } } steps { - powershell """ - if (-Not (Test-Path \"${env.WORKSPACE}\\builds\")) { - New-Item -ItemType Directory -Path \"${env.WORKSPACE}\\builds\" | Out-Null - } - Compress-Archive -Path \"${env.WORKSPACE}\\**\\Release\\*\" ` - -DestinationPath \"${env.WORKSPACE}\\builds\\KhaoticEngineReborn_Release.zip\" ` - -Force + 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" """ } } @@ -88,15 +91,14 @@ pipeline { post { success { script { - def urls = [] - if (params.BUILD_TYPE in ['Both','Debug']) { - urls << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Debug.zip" + def urlsList = [] + if (params.BUILD_TYPE in ['Both', 'Debug']) { + urlsList << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Debug.zip" } - if (params.BUILD_TYPE in ['Both','Release']) { - urls << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Release.zip" + if (params.BUILD_TYPE in ['Both', 'Release']) { + urlsList << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Release.zip" } - // Construire le JSON correct pour l'envoi - def urlsJson = urls.collect { "\"${it}\"" }.join(',') + def urlsJson = urlsList.collect { "\"${it}\"" }.join(',') urlsJson = "[${urlsJson}]" bat """