| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- pipeline {
- agent { label 'windows-host' }
- environment {
- DOTNET_CLI_TELEMETRY_OPTOUT = '1'
- JAVA_TOOL_OPTIONS = '-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8'
- }
- stages {
- stage('Checkout') {
- steps {
- checkout scm
- }
- }
- stage('Build') {
- steps {
- bat 'dotnet publish Web.Api -c Release -r win-x64 -o publish\\api'
- bat 'dotnet publish Admin -c Release -r win-x64 -o publish\\admin'
- }
- }
- stage('Stop Services') {
- steps {
- bat 'sc.exe stop bitforum-Api || exit 0'
- bat 'sc.exe stop bitforum-Admin || exit 0'
- bat 'ping 127.0.0.1 -n 6 > nul'
- }
- }
- stage('Deploy API') {
- steps {
- bat 'robocopy publish\\api H:\\IIS\\bitforum-api\\sources /MIR /XF web.config restart.ps1 /NFL /NDL /NP & if %ERRORLEVEL% LEQ 7 exit /b 0'
- }
- }
- stage('Deploy Admin') {
- steps {
- bat 'robocopy publish\\admin H:\\IIS\\bitforum-admin\\sources /MIR /XF web.config restart.ps1 /NFL /NDL /NP & if %ERRORLEVEL% LEQ 7 exit /b 0'
- }
- }
- stage('Start Services') {
- steps {
- bat 'sc.exe start bitforum-Api'
- bat 'sc.exe start bitforum-Admin'
- }
- }
- }
- post {
- success { echo 'Backend deploy success!' }
- failure { echo 'Backend deploy failed!' }
- }
- }
|