summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndrew Dolgov <noreply@fakecake.org>2022-10-02 11:51:34 +0300
committerAndrew Dolgov <noreply@fakecake.org>2022-10-02 11:51:34 +0300
commit726faa085973d007ff9655c2a1fd0b7e480044ad (patch)
tree833cc950db0599b8919873cc4cf719209ba5267e
parent993a8d0d1388c11e4e851dc96ac8a4f21e770fd4 (diff)
downloadthe-epube-android-726faa085973d007ff9655c2a1fd0b7e480044ad.tar.gz
the-epube-android-726faa085973d007ff9655c2a1fd0b7e480044ad.tar.xz
add Jenkinsfile
-rw-r--r--Jenkinsfile54
1 files changed, 54 insertions, 0 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..73c4168
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,54 @@
+pipeline {
+    agent any
+
+    environment {
+        ANDROID_HOME = "/var/jenkins_home/android-sdk"
+        JAVA_HOME = "/usr/lib/jvm/java-11-openjdk-amd64/"
+
+        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') {
+            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: 'jenkins@fakecake.org',
+                mimeType: 'text/html',
+                subject: "Build failed: ${env.JOB_NAME}",
+                to: "fox@fakecake.org";
+         }
+    }
+}
\ No newline at end of file