diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..e8e8809 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,44 @@ +pipeline { + agent any + + tools { + node '15.14.0' + } + + stages { + stage ('Initialize') { + steps { + echo 'Initializing..' + } + } + stage('Build') { + steps { + sh 'npm install' + sh 'npm run build' + } + } + stage('Archive') { + when { + branch 'master' + expression { + currentBuild.result == null || currentBuild.result == 'SUCCESS' + } + } + steps { + echo 'Archiving....' + + dir("dist") { + sh 'git init' + sh 'git add .' + sh 'git config --global user.email "jenkins@bosym.de"' + sh 'git config --global user.name "Jenkins"' + sh 'git commit -m "Deploy by Jenkins"' + withCredentials([usernamePassword(credentialsId: 'f9aaa85c-5f26-4e5c-82fa-1c05127a6648', usernameVariable: 'username', passwordVariable: 'password')]) + { + sh "git push --force --quiet \"https://$username:$password@git.syma.dev/Pascal/expenses.git\" master:gh-pages" + } + } + } + } + } +}