Jenkinsfile 1.1 KB

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