From 741cc08ff4895b092ab2b5340cfc283e132bde01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Wed, 5 Sep 2018 16:15:44 -0400 Subject: [PATCH] add Jenkinsfile --- Jenkinsfile | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..adc9774 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,39 @@ +def gh_branch = 'master' +def gh_repo = 'github.com/status-im/analytics.status.im.git' +def gh_user = 'status-im-auto' +def gh_email = 'auto@status.im' + +node('linux') { + stage('Git Prep') { + checkout scm + dir('analytics') { + git(url: "https://${gh_repo}") + } + sh "git config user.name ${gh_user}" + sh "git config user.email ${gh_email}" + sh "git config --global push.default simple" + /* Install Python3 requirements */ + sh 'pip3 install --user -r requirements.txt' + } + + stage('Generate Images') { + withCredentials([ + string(credentialsId: 'appfigures-key', variable: 'CLIENT_KEY'), + string(credentialsId: 'appfigures-header', variable: 'AUTH_HEADER'), + ]) { + sh './appfigures.py analytics' + } + } + + stage('Push Changes') { + withCredentials([ + string(credentialsId: 'jenkins-github-token', variable: 'GH_TOKEN'), + ]) { + def gh_url = "https://${gh_user}:${env.GH_TOKEN}@${gh_repo}" + dir('analytics') { + sh 'git commit -m "update analytics-dash images" .' + sh "git push ${gh_url} ${gh_branch}" + } + } + } +}