|
@@ -4,9 +4,31 @@ pipeline {
|
|
|
DEPLOY_FRONTEND = '/mnt/h/bitforum/sources'
|
|
DEPLOY_FRONTEND = '/mnt/h/bitforum/sources'
|
|
|
}
|
|
}
|
|
|
stages {
|
|
stages {
|
|
|
|
|
+ stage('Install') {
|
|
|
|
|
+ steps {
|
|
|
|
|
+ script {
|
|
|
|
|
+ // package-lock.json 해시 비교해서 변경됐을 때만 재설치
|
|
|
|
|
+ def lockHash = sh(
|
|
|
|
|
+ script: 'sha256sum package-lock.json | cut -d" " -f1',
|
|
|
|
|
+ returnStdout: true
|
|
|
|
|
+ ).trim()
|
|
|
|
|
+ def cacheFile = '.npm-lock-hash'
|
|
|
|
|
+ def prevHash = fileExists(cacheFile)
|
|
|
|
|
+ ? readFile(cacheFile).trim()
|
|
|
|
|
+ : ''
|
|
|
|
|
+
|
|
|
|
|
+ if (lockHash != prevHash) {
|
|
|
|
|
+ echo "package-lock.json 변경 감지 → npm ci 실행"
|
|
|
|
|
+ sh 'npm ci'
|
|
|
|
|
+ writeFile file: cacheFile, text: lockHash
|
|
|
|
|
+ } else {
|
|
|
|
|
+ echo "package-lock.json 변경 없음 → 설치 스킵"
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
stage('Build') {
|
|
stage('Build') {
|
|
|
steps {
|
|
steps {
|
|
|
- sh 'npm ci --prefer-offline'
|
|
|
|
|
sh 'npm run build'
|
|
sh 'npm run build'
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -18,7 +40,6 @@ pipeline {
|
|
|
--exclude="ecosystem.config.js" \
|
|
--exclude="ecosystem.config.js" \
|
|
|
--exclude="restart.ps1" \
|
|
--exclude="restart.ps1" \
|
|
|
--exclude=".env*" \
|
|
--exclude=".env*" \
|
|
|
- --exclude="node_modules/.cache" \
|
|
|
|
|
.next/standalone/ ${DEPLOY_FRONTEND}/
|
|
.next/standalone/ ${DEPLOY_FRONTEND}/
|
|
|
'''
|
|
'''
|
|
|
sh 'rsync -a --stats --delete .next/static/ ${DEPLOY_FRONTEND}/.next/static/'
|
|
sh 'rsync -a --stats --delete .next/static/ ${DEPLOY_FRONTEND}/.next/static/'
|