Files
csgowtf/Jenkinsfile
Giovanni Harting 2b188b089c
Some checks are pending
CSGOWTF/csgowtf/pipeline/pr-master Build queued...
CSGOWTF/csgowtf/pipeline/head This commit looks good
added discard old builds
2022-06-23 00:28:48 +02:00

64 lines
2.2 KiB
Groovy

pipeline {
agent any
options {
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: ''))
}
environment {
FTP_HOST = credentials('csgowtf-deploy-host')
LFTP_PASSWORD = credentials('csgowtf-deploy-password')
API_HOST = credentials('csgowtf-api-host')
TRACK_HOST = credentials('csgowtf-track-host')
TRACK_ID = credentials('csgowtf-track-id')
TRACK_DOMAINS = credentials('csgowtf-track-domains')
TRACK = credentials('csgowtf-track')
}
stages {
stage('Prepare') {
steps {
writeFile file: '.env.production', text: 'VUE_APP_API_URL=$API_HOST\nVUE_APP_TRACK_URL=$TRACK_HOST\nVUE_APP_TRACK_ID=$TRACK_ID\nVUE_APP_TRACK_DOMAINS=$TRACK_DOMAINS\nVUE_APP_TRACKING=$TRACK'
}
}
stage('Install Dependencies') {
steps {
sh 'yarn install'
}
}
stage('Build') {
steps {
sh 'yarn build'
archiveArtifacts artifacts: '**/dist/**', excludes: '**/node_modules/**'
}
}
stage('Deploy') {
when {
branch 'master'
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
}
}
environment {
FTP_USERNAME = credentials('csgowtf-deploy-user')
}
steps {
sh 'lftp -u $FTP_USERNAME --env-password -e \'mirror --reverse --verbose --delete --recursion=always dist/ /\' $FTP_HOST'
}
}
stage('Deploy Dev') {
when {
branch 'dev'
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
}
}
environment {
FTP_USERNAME = credentials('csgowtf-deploy-user-dev')
}
steps {
sh 'lftp -u $FTP_USERNAME --env-password -e \'mirror --reverse --verbose --delete --recursion=always dist/ /\' $FTP_HOST'
}
}
}
}