Jenkinsfile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. pipeline {
  2. agent { label 'built-in' }
  3. environment {
  4. DEPLOY_FRONTEND = '/mnt/h/bitforum/sources'
  5. }
  6. stages {
  7. stage('Build') {
  8. steps {
  9. sh 'npm ci --prefer-offline'
  10. sh 'npm run build'
  11. }
  12. }
  13. stage('Deploy') {
  14. steps {
  15. sh '''
  16. rsync -a --stats --delete \
  17. --exclude="web.config" \
  18. --exclude="ecosystem.config.js" \
  19. --exclude="restart.ps1" \
  20. --exclude=".env*" \
  21. --exclude="node_modules/.cache" \
  22. .next/standalone/ ${DEPLOY_FRONTEND}/
  23. '''
  24. sh 'rsync -a --stats --delete .next/static/ ${DEPLOY_FRONTEND}/.next/static/'
  25. sh 'rsync -a --stats --delete public/ ${DEPLOY_FRONTEND}/public/'
  26. }
  27. }
  28. stage('Restart Frontend') {
  29. agent { label 'windows-host' }
  30. steps {
  31. bat 'chcp 65001 && powershell.exe -ExecutionPolicy Bypass -File H:\\IIS\\bitforum\\restart.ps1'
  32. }
  33. }
  34. }
  35. post {
  36. success { echo 'Frontend deploy success!' }
  37. failure { echo 'Frontend deploy failed!' }
  38. }
  39. }