diff --git a/Jenkinsfile b/Jenkinsfile index 0d18d1f..9a5a622 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,27 +1,31 @@ env.HL_BUILD_MODE = "jenkins" -node('Rubidium'){ +node('Lithium'){ stage('get new version to repo') { - dir('/opt/usersite-build'){ - checkout([$class: 'GitSCM', branches: [[name: '*/fashion-logica']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'jenkins_all', url: 'https://git.hlcompany.ru/git/usersite.git']]]) + checkout scm + if (lastCommitIsBumpCommit()) { + currentBuild.result = 'ABORTED' + error('Последний коммит - результат сборки jenkins') } - } - - stage('build project') { - // sh label: '', script: 'systemctl stop lkcrm4retail' - // dir('/opt/SynthVisionBox/node'){ - // sh label: '', script: 'npm install --only=prod' - // sh label: '', script: 'node db_updater.js' - // } + sh "git checkout ${env.BRANCH_NAME}" + sh "git checkout -- ." - dir('/opt/usersite-build'){ - sh label: '', script: 'npm i' - // sh label: '', script: 'npm run build' - sh label: '', script: 'ng build' - } - - // sh label: '', script: 'systemctl start lkcrm4retail' + sh "git pull" + //sh "git submodule update --init --recursive" + //sh "git submodule update --remote --merge" + } + stage("build and publish"){ + sh label: '', script: 'npm i' + sh label: '', script: 'npm run build' } - -} \ No newline at end of file +} + +private boolean lastCommitIsBumpCommit() { + lastCommit = sh([script: 'git log -1', returnStdout: true]) + if (lastCommit.contains("Author: jenkins")) { + return true + } else { + return false + } +} diff --git a/angular.json b/angular.json index 7bbfa77..ea8448c 100644 --- a/angular.json +++ b/angular.json @@ -1,4 +1,5 @@ { + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", @@ -10,6 +11,7 @@ "style": "scss" } }, + "root": "", "sourceRoot": "src", "prefix": "app", @@ -17,7 +19,7 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "/var/www/fashion-logica", + "outputPath": "/var/www/html/lk.crm4retail.ru/fashion-logica", "baseHref": "/", "index": "src/index.html", "main": "src/main.ts",