diff --git a/Jenkinsfile b/Jenkinsfile index 1300270..0974529 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,11 @@ pipeline { agent any + environment { + FTP_HOST = credentials('csgowtf-deploy-host') + FTP_PASSWORD = credentials('csgowtf-deploy-password') + } + stages { stage('Prepare') { steps { @@ -18,5 +23,27 @@ pipeline { archiveArtifacts artifacts: '**/dist/**', excludes: '**/node_modules/**' } } + stage('Deploy') { + when { + branch 'master' + } + environment { + FTP_USERNAME = credentials('csgowtf-deploy-user') + } + steps { + sh 'deploy.sh' + } + } + stage('Deploy Dev') { + when { + branch 'dev' + } + environment { + FTP_USERNAME = credentials('csgowtf-deploy-user-dev') + } + steps { + sh 'deploy.sh' + } + } } } diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..58431bd --- /dev/null +++ b/deploy.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +lftp -c "open -e \"set ftp:ssl-auth TLS; \ + set ftp:ssl-force true; \ + set ftp:ssl-protect-list yes; \ + set ftp:ssl-protect-data yes; \ + set ftp:ssl-protect-fxp yes; \ + set ssl:verify-certificate no; \ + rm -r *; \ + mput dist/*; \" \ + -u '$FTP_USERNAME','$FTP_PASSWORD' \ + ftps://$FTP_HOST"