blob: 6398972465320b0d528464af61632e08691e7c22 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
}
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]";
}
}
}
|