Jenkinsfile 1.0 KB

12345678910111213141516171819202122232425262728293031
  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 install'
  10. sh 'npm run build'
  11. }
  12. }
  13. stage('Deploy') {
  14. steps {
  15. sh 'rsync -av --delete --exclude="web.config" --exclude="ecosystem.config.js" --exclude="restart.ps1" --exclude=".env*" .next/standalone/ ${DEPLOY_FRONTEND}/'
  16. sh 'rsync -av --delete .next/static/ ${DEPLOY_FRONTEND}/.next/static/'
  17. sh 'rsync -av --delete public/ ${DEPLOY_FRONTEND}/public/'
  18. }
  19. }
  20. stage('Restart Frontend') {
  21. agent { label 'windows-host' }
  22. steps {
  23. bat 'chcp 65001 && powershell.exe -ExecutionPolicy Bypass -File H:\\IIS\\bitforum\\restart.ps1'
  24. }
  25. }
  26. }
  27. post {
  28. success { echo 'Frontend deploy success!' }
  29. failure { echo 'Frontend deploy failed!' }
  30. }
  31. }