diff options
author | Andrew Dolgov <[email protected]> | 2022-10-02 12:05:29 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2022-10-02 12:06:41 +0300 |
commit | f2f76af7317b7c95a4dbda47784593d9b86c7c4f (patch) | |
tree | d4c9d5b9ae2758ae7c2541b182ea23deaebc024a | |
parent | da0e97b8a983ae2d769c3730d694cfe8613b038a (diff) |
add Jenkinsfile
-rw-r--r-- | Jenkinsfile | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..dd8f6fb3 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,54 @@ +pipeline { + agent any + + environment { + deploy_key = "srv.tt-rss.org" + deploy_host = "tt-rss.fakecake.org" + } + + stages { + stage('build') { + steps { + withCredentials([string(credentialsId: 'fdroid.jks', variable: 'FDROID_PASSWORD')]) { + sh("bash ./gradlew assembleFdroid " + + "-PFDROID_STORE_FILE=/var/jenkins_home/android-jks/fdroid.jks " + + "-PFDROID_STORE_PASSWORD=$FDROID_PASSWORD " + + "-PFDROID_KEY_ALIAS=fdroid " + + "-PFDROID_KEY_PASSWORD=$FDROID_PASSWORD") + } + } + } + stage('archive') { + steps { + archiveArtifacts '**/*.apk' + } + } + stage('deploy') { + when { + branch 'master' + } + steps { + sshagent(credentials: ["${deploy_key}"]) { + script { + def files = findFiles(glob: '**/*.apk') + + for (String file : files) { + sh("scp -oStrictHostKeyChecking=no ${file} ${deploy_host}:fdroid/repo/") + } + + sh("ssh -oStrictHostKeyChecking=no ${deploy_host} sudo /usr/local/sbin/fdroid-update-repo") + } + } + } + } + } + post { + failure { + mail body: "Project: ${env.JOB_NAME} <br>Build Number: ${env.BUILD_NUMBER}<br> build URL: ${env.BUILD_URL}", + charset: 'UTF-8', from: '[email protected]', + mimeType: 'text/html', + subject: "Build failed: ${env.JOB_NAME}", + to: "[email protected]"; + } + } +} |