forked from reportico-web/reportico
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
51 lines (44 loc) · 1.01 KB
/
build.gradle
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
plugins {
id 'org.hidetake.ssh' version '2.9.0'
}
defaultTasks 'buildDist'
def distTargetDir = name + '/'
def deployTargetDir = 'www/reportico'
def deployKey = file(System.getenv('RCAREDEPLOY_KEY_PATH') ?: System.getenv('HOME') + '/.ssh/rcaredeploy.id_rsa')
remotes {
remsupport {
host = '10.199.0.1'
user = 'rcaredeploy'
identity = deployKey
}
}
task buildDist(type: Tar) {
from('./') {
exclude 'build.gradle'
exclude 'dist/'
exclude '.gradle/'
exclude '.git/'
into distTargetDir
}
destinationDir = file('dist')
baseName = rootProject.name
extension = 'tar.gz'
compression = Compression.GZIP
}
task checkDeployKey {
doLast {
if(!deployKey.exists()) {
throw new GradleException('Could not find deploy key: ' + deployKey + '; Set path to key using RCAREDEPLOY_KEY_PATH environment var')
}
}
}
task deploy {
dependsOn ':checkDeployKey', ':buildDist'
doLast {
ssh.run {
session(remotes.remsupport) {
put from: 'dist/' + buildDist.archiveName, into: deployTargetDir
}
}
}
}