Skip to content
Permalink
production
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#!groovy
properties(
[
[$class: 'BuildDiscarderProperty', strategy:
[$class: 'LogRotator', artifactDaysToKeepStr: '14', artifactNumToKeepStr: '5', daysToKeepStr: '30', numToKeepStr: '60']],
pipelineTriggers(
[
pollSCM('H/15 * * * *'),
cron('@daily'),
]
)
]
)
node {
stage('Checkout') {
//disable to recycle workspace data to save time/bandwidth
deleteDir()
checkout scm
//enable for commit id in build number
//env.git_commit_id = sh returnStdout: true, script: 'git rev-parse HEAD'
//env.git_commit_id_short = env.git_commit_id.take(7)
//currentBuild.displayName = "#${currentBuild.number}-${env.git_commit_id_short}"
}
stage('NPM Install') {
withEnv(["NPM_CONFIG_LOGLEVEL=warn"]) {
sh 'npm install'
}
}
// stage('Lint') {
// sh 'ng lint'
// }
stage('Build') {
milestone()
sh 'ng build --prod --aot --base-href /branches/' + env.BRANCH_NAME + '/ --progress=false'
}
stage('Archive') {
sh 'tar -cvzf dist.tar.gz --strip-components=1 dist'
archive 'dist.tar.gz'
}
stage('Deploy') {
milestone()
echo "Deploying..."
sh 'rm -rf /var/www/branches/' + env.BRANCH_NAME
sh 'mkdir /var/www/branches/' + env.BRANCH_NAME
sh 'cp -r dist/. /var/www/branches/' + env.BRANCH_NAME + '/'
sh 'cp /var/www/.htaccess-template /var/www/branches/' + env.BRANCH_NAME + '/.htaccess'
}
}