forked from researchgate/gradle-release
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.gradle
110 lines (95 loc) · 2.73 KB
/
release.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//// PLUGINS
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.2'
}
}
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'nexus'
apply from: 'installation/apply-local.groovy'
//// CONFIGURATION
configurations {
releaseArtifacts {}
installers {}
latestInstallers {}
deployerJars {}
}
repositories {
mavenCentral()
mavenRepo url: 'http://m2repo.spockframework.org/snapshots'
}
dependencies {
compile gradleApi()
groovy localGroovy()
testCompile("org.spockframework:spock-core:$spockVersion") { exclude group: 'org.codehaus.groovy' }
testCompile "junit:junit:$junitVersion",
"org.ajoberstar:gradle-git:$gradleGitVersion"
}
signing {
sign configurations.releaseArtifacts
}
modifyPom {
project {
name 'gradle-release'
packaging 'jar'
description 'gradle-release is a plugin for providing a Maven-like release process to project using Gradle.'
url 'https://github.com/townsfolk/gradle-release'
scm {
url 'scm:[email protected]:townsfolk/gradle-release.git'
connection 'scm:[email protected]:townsfolk/gradle-release.git'
developerConnection 'scm:[email protected]:townsfolk/gradle-release.git'
}
licenses {
license {
name 'The MIT License (MIT)'
url 'http://opensource.org/licenses/MIT'
distribution 'repo'
}
}
developers {
developer {
id 'townsfolk'
name 'Eric Berry'
}
}
}
}
//// TASKS
createReleaseTag.dependsOn uploadReleaseArtifacts
createReleaseTag.dependsOn uploadInstallers
updateVersion << {
// This updates the apply script with the new version.
def applyFile = new File("installation", "apply.groovy")
def readmeFile = new File("README.md")
def oldVersion = project.getProperty("release.oldVersion")
def newVersion = project.getProperty("release.newVersion")
ant.replace(file: applyFile, token: "${group}:${name}:${oldVersion}", value: "${group}:${name}:${newVersion}")
ant.replaceregexp(file: readmeFile, match: "Current Version: .*?\$", replace: "Current Version: ${oldVersion}", byline: true)
ant.replaceregexp(file: readmeFile, match: "gradle-release/\\d+\\.\\d+/apply.groovy", replace: "gradle-release/${oldVersion}/apply.groovy", byline: true)
}
//// DEPLOYMENT
uploadInstallers {
repositories {
add(new org.apache.ivy.plugins.resolver.SFTPResolver()) {
host = releaseRepoHost
addArtifactPattern "${releaseRepoBase}/[module]/[revision]/[artifact].[ext]"
}
}
}
uploadLatestInstallers {
repositories {
add(new org.apache.ivy.plugins.resolver.SFTPResolver()) {
host = releaseRepoHost
addArtifactPattern "${releaseRepoBase}/[module]/[artifact].[ext]"
}
}
}
artifacts {
installers file('installation/apply.groovy')
latestInstallers file('installation/apply.groovy')
}