| 123456789101112131415161718192021222324252627282930313233343536373839 |
- pipeline {
- agent { label 'built-in' }
- environment {
- DEPLOY_FRONTEND = '/mnt/h/bitforum/sources'
- }
- stages {
- stage('Build') {
- steps {
- sh 'npm ci --prefer-offline'
- sh 'npm run build'
- }
- }
- stage('Deploy') {
- steps {
- sh '''
- rsync -a --stats --delete \
- --exclude="web.config" \
- --exclude="ecosystem.config.js" \
- --exclude="restart.ps1" \
- --exclude=".env*" \
- --exclude="node_modules/.cache" \
- .next/standalone/ ${DEPLOY_FRONTEND}/
- '''
- sh 'rsync -a --stats --delete .next/static/ ${DEPLOY_FRONTEND}/.next/static/'
- sh 'rsync -a --stats --delete public/ ${DEPLOY_FRONTEND}/public/'
- }
- }
- stage('Restart Frontend') {
- agent { label 'windows-host' }
- steps {
- bat 'chcp 65001 && powershell.exe -ExecutionPolicy Bypass -File H:\\IIS\\bitforum\\restart.ps1'
- }
- }
- }
- post {
- success { echo 'Frontend deploy success!' }
- failure { echo 'Frontend deploy failed!' }
- }
- }
|