Skip to content

Commit 5d4a4cc

Browse files
authored
Merge pull request #366 from yidongnan/modify_deploy.gradle
Modify deploy.gradle for github actions and test pull-request workflow
2 parents a7e8ef4 + d253c28 commit 5d4a4cc

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ buildscript {
1717

1818
springBootVersion = '2.2.7.RELEASE'
1919
springCloudVersion = 'Hoxton.SR4'
20-
springDependencyManagementVersion = '1.0.9.RELEASE'
2120
springCloudAlibabaNacosVersion = '2.2.1.RELEASE'
2221
springSecurityOAuthVersion = '2.4.1.RELEASE'
2322

deploy.gradle

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
11
apply plugin: 'maven-publish'
22
apply plugin: 'signing'
33

4-
gradle.taskGraph.whenReady { taskGraph ->
5-
if (taskGraph.allTasks.any { it instanceof Sign } && project.ext.isReleaseVersion) {
6-
def id = System.getenv('GPG_ID')
7-
def file = '/home/travis/.gnupg/secring.gpg'
8-
def password = System.getenv('GPG_PASSWORD')
9-
10-
allprojects { ext."signing.keyId" = id }
11-
allprojects { ext."signing.secretKeyRingFile" = file }
12-
allprojects { ext."signing.password" = password }
13-
}
14-
}
15-
164
ext {
175
isReleaseVersion = !(projectVersion =~ /-SNAPSHOT$/)
18-
isNeedSign = System.getenv('GPG_ID') && isReleaseVersion
196
}
207

218
task sourcesJar(type: Jar) {
@@ -67,6 +54,15 @@ publishing {
6754
url = 'https://github.com/yidongnan/grpc-spring-boot-starter'
6855
}
6956
}
57+
58+
versionMapping {
59+
usage('java-api') {
60+
fromResolutionOf('runtimeClasspath')
61+
}
62+
usage('java-runtime') {
63+
fromResolutionResult()
64+
}
65+
}
7066
}
7167
}
7268
repositories {
@@ -83,8 +79,12 @@ publishing {
8379
}
8480
}
8581

82+
tasks.withType(Sign) {
83+
onlyIf { project.ext.isReleaseVersion && gradle.taskGraph.hasTask("publish") }
84+
}
85+
8686
signing {
87-
required { project.ext.isNeedSign }
87+
useGpgCmd()
8888
sign publishing.publications.mavenJava
8989
}
9090

0 commit comments

Comments
 (0)