@@ -22,54 +22,69 @@ class Publishers {
22
22
}
23
23
24
24
def gradlePlugin (String publishKeySecret , String publishSecretSecret ,
25
- String checkTask = PipelineConventions . standard. checkTask) {
26
- jenkins. withCredentials([jenkins. string(credentialsId : publishKeySecret, variable : " GRADLE_PUBLISH_KEY" ),
27
- jenkins. string(credentialsId : publishSecretSecret, variable : " GRADLE_PUBLISH_SECRET" )]) {
28
- gradle. wrapper(" ${ releaseType} " +
29
- " -Pgradle.publish.key=${ jenkins.GRADLE_PUBLISH_KEY} " +
30
- " -Pgradle.publish.secret=${ jenkins.GRADLE_PUBLISH_SECRET} " +
31
- " -Prelease.stage=${ releaseType} " +
32
- " -Prelease.scope=${ releaseScope} -x ${ checkTask} " )
25
+ PipelineConventions conventions = PipelineConventions . standard) {
26
+ String checkTask = conventions. checkTask
27
+ String workingDir = conventions. workingDir
28
+ jenkins. dir(workingDir) {
29
+ jenkins. withCredentials([jenkins. string(credentialsId : publishKeySecret, variable : " GRADLE_PUBLISH_KEY" ),
30
+ jenkins. string(credentialsId : publishSecretSecret, variable : " GRADLE_PUBLISH_SECRET" )]) {
31
+ gradle. wrapper(" ${ releaseType} " +
32
+ " -Pgradle.publish.key=${ jenkins.GRADLE_PUBLISH_KEY} " +
33
+ " -Pgradle.publish.secret=${ jenkins.GRADLE_PUBLISH_SECRET} " +
34
+ " -Prelease.stage=${ releaseType} " +
35
+ " -Prelease.scope=${ releaseScope} -x ${ checkTask} " )
36
+ }
33
37
}
34
38
}
35
39
36
- def bintray (String bintraySecret , String checkTask = PipelineConventions . standard. checkTask) {
37
- jenkins. withCredentials([jenkins. usernamePassword(credentialsId : bintraySecret, usernameVariable : " BINTRAY_USER" ,
38
- passwordVariable : " BINTRAY_API_KEY" )]) {
39
- gradle. wrapper(" ${ releaseType} " +
40
+ def bintray (String bintraySecret , PipelineConventions conventions = PipelineConventions . standard) {
41
+ String checkTask = conventions. checkTask
42
+ String workingDir = conventions. workingDir
43
+ jenkins. dir(workingDir) {
44
+ jenkins. withCredentials([jenkins. usernamePassword(credentialsId : bintraySecret, usernameVariable : " BINTRAY_USER" ,
45
+ passwordVariable : " BINTRAY_API_KEY" )]) {
46
+ gradle. wrapper(" ${ releaseType} " +
40
47
" -Pbintray.user=${ jenkins.BINTRAY_USER} " +
41
48
" -Pbintray.key=${ jenkins.BINTRAY_API_KEY} " +
42
49
" -Prelease.stage=${ releaseType} " +
43
50
" -Prelease.scope=${ releaseScope} -x ${ checkTask} " )
51
+ }
44
52
}
45
53
}
46
54
47
- def ossrh (String publishSecret , String signingKeySecret , String signingKeyIdSecret , String signingPassphraseSecret ,
48
- String checkTask = PipelineConventions . standard. checkTask) {
49
- def credentials = [jenkins. usernamePassword(credentialsId : publishSecret,
50
- usernameVariable :" OSSRH_USERNAME" , passwordVariable : " OSSRH_PASSWORD" )] +
51
- ossrhSigningCredentials(signingKeySecret, signingKeyIdSecret, signingPassphraseSecret)
52
- jenkins. withCredentials(credentials) {
53
- gradle. wrapper(" ${ releaseType} " +
54
- " -Prelease.stage=${ releaseType} " +
55
- " -Prelease.scope=${ releaseScope} -x ${ checkTask} " )
55
+ def ossrh (String publishSecret , String signingKeySecret , String signingKeyIdSecret , String signingPassphraseSecret , PipelineConventions conventions = PipelineConventions . standard) {
56
+ String checkTask = conventions. checkTask
57
+ String workingDir = conventions. workingDir
58
+ jenkins. dir(workingDir) {
59
+ def credentials = [jenkins. usernamePassword(credentialsId : publishSecret,
60
+ usernameVariable : " OSSRH_USERNAME" , passwordVariable : " OSSRH_PASSWORD" )] +
61
+ ossrhSigningCredentials(signingKeySecret, signingKeyIdSecret, signingPassphraseSecret)
62
+ jenkins. withCredentials(credentials) {
63
+ gradle. wrapper(" ${ releaseType} " +
64
+ " -Prelease.stage=${ releaseType} " +
65
+ " -Prelease.scope=${ releaseScope} -x ${ checkTask} " )
66
+ }
56
67
}
57
68
}
58
69
59
70
def artifactoryOSSRH (String artifactorySecret ,
60
71
String signingKeySecret , String signingKeyIdSecret , String signingPassphraseSecret ,
61
- String checkTask = PipelineConventions . standard. checkTask) {
62
- def credentials = [
63
- jenkins. usernamePassword(credentialsId : artifactorySecret,
64
- usernameVariable :" ARTIFACTORY_USER" ,
65
- passwordVariable : " ARTIFACTORY_PASS" )
66
- ] + ossrhSigningCredentials(signingKeySecret, signingKeyIdSecret, signingPassphraseSecret)
67
- jenkins. withCredentials(credentials) {
68
- gradle. wrapper(" ${ releaseType} " +
69
- " -Partifactory.user=${ jenkins.ARTIFACTORY_USER} " +
70
- " -Partifactory.password=${ jenkins.ARTIFACTORY_PASS} " +
71
- " -Prelease.stage=${ releaseType} " +
72
- " -Prelease.scope=${ releaseScope} -x ${ checkTask} " )
72
+ PipelineConventions conventions = PipelineConventions . standard) {
73
+ String checkTask = conventions. checkTask
74
+ String workingDir = conventions. workingDir
75
+ jenkins. dir(workingDir) {
76
+ def credentials = [
77
+ jenkins. usernamePassword(credentialsId : artifactorySecret,
78
+ usernameVariable : " ARTIFACTORY_USER" ,
79
+ passwordVariable : " ARTIFACTORY_PASS" )
80
+ ] + ossrhSigningCredentials(signingKeySecret, signingKeyIdSecret, signingPassphraseSecret)
81
+ jenkins. withCredentials(credentials) {
82
+ gradle. wrapper(" ${ releaseType} " +
83
+ " -Partifactory.user=${ jenkins.ARTIFACTORY_USER} " +
84
+ " -Partifactory.password=${ jenkins.ARTIFACTORY_PASS} " +
85
+ " -Prelease.stage=${ releaseType} " +
86
+ " -Prelease.scope=${ releaseScope} -x ${ checkTask} " )
87
+ }
73
88
}
74
89
}
75
90
@@ -82,41 +97,54 @@ class Publishers {
82
97
}
83
98
84
99
def unityArtifactoryPaket (String unityPath , String artifactorySecret ,
85
- String checkTask = PipelineConventions . standard. checkTask) {
86
- jenkins. withEnv([" UNITY_PACKAGE_MANAGER = paket" , " UNITY_PATH=${ unityPath} " , " UNITY_LOG_CATEGORY=build" ]) {
87
- jenkins. withCredentials([jenkins. usernameColonPassword(credentialsId : artifactorySecret, variable : " NUGET_KEY" ),
88
- jenkins. usernameColonPassword(credentialsId : artifactorySecret, variable : " nugetkey" )]) {
89
- gradle. wrapper(" ${ releaseType} " +
90
- " -Prelease.stage=${ releaseType} " +
91
- " -Ppaket.publish.repository='${ releaseType} ' " +
92
- " -Prelease.scope=${ releaseScope} -x ${ checkTask} " )
100
+ PipelineConventions conventions = PipelineConventions . standard) {
101
+ String checkTask = conventions. checkTask
102
+ String workingDir = conventions. workingDir
103
+ jenkins. dir(workingDir) {
104
+ jenkins. withEnv([" UNITY_PACKAGE_MANAGER = paket" , " UNITY_PATH=${ unityPath} " , " UNITY_LOG_CATEGORY=build" ]) {
105
+ jenkins. withCredentials([jenkins. usernameColonPassword(credentialsId : artifactorySecret, variable : " NUGET_KEY" ),
106
+ jenkins. usernameColonPassword(credentialsId : artifactorySecret, variable : " nugetkey" )]) {
107
+ gradle. wrapper(" ${ releaseType} " +
108
+ " -Prelease.stage=${ releaseType} " +
109
+ " -Ppaket.publish.repository='${ releaseType} ' " +
110
+ " -Prelease.scope=${ releaseScope} -x ${ checkTask} " )
111
+ }
93
112
}
94
113
}
95
114
}
96
115
97
- def npm (String npmCredsSecret ) {
98
- def credentials = [
99
- jenkins. usernamePassword(credentialsId : npmCredsSecret,
100
- usernameVariable :" NODE_RELEASE_NPM_USER" ,
101
- passwordVariable : " NODE_RELEASE_NPM_PASS" )
102
- ]
103
- jenkins. withCredentials(credentials) {
104
- gradle. wrapper(" ${ releaseType} -Prelease.stage=${ releaseType} -Prelease.scope=${ releaseScope} -x check" )
116
+ def npm (String npmCredsSecret ,
117
+ PipelineConventions conventions = PipelineConventions . standard) {
118
+ String checkTask = conventions. checkTask
119
+ String workingDir = conventions. workingDir
120
+ jenkins. dir(workingDir) {
121
+ def credentials = [
122
+ jenkins. usernamePassword(credentialsId : npmCredsSecret,
123
+ usernameVariable : " NODE_RELEASE_NPM_USER" ,
124
+ passwordVariable : " NODE_RELEASE_NPM_PASS" )
125
+ ]
126
+ jenkins. withCredentials(credentials) {
127
+ gradle. wrapper(" ${ releaseType} -Prelease.stage=${ releaseType} -Prelease.scope=${ releaseScope} -x ${ checkTask} " )
128
+ }
105
129
}
106
130
}
107
131
108
- def unityArtifactoryUpm (String artifactorySecret ) {
109
- jenkins. withEnv([" UNITY_PACKAGE_MANAGER = upm" , " UNITY_LOG_CATEGORY=build" ]) {
110
- jenkins. withCredentials([jenkins. usernamePassword(credentialsId : artifactorySecret, usernameVariable :" UPM_USERNAME" , passwordVariable : " UPM_PASSWORD" ),
111
- jenkins. usernameColonPassword(credentialsId : artifactorySecret, variable : " NUGET_KEY" ),
112
- jenkins. usernameColonPassword(credentialsId : artifactorySecret, variable : " nugetkey" )]) {
132
+ def unityArtifactoryUpm (String artifactorySecret ,
133
+ PipelineConventions conventions = PipelineConventions . standard) {
134
+ String workingDir = conventions. workingDir
135
+ jenkins. dir(workingDir) {
136
+ jenkins. withEnv([" UNITY_PACKAGE_MANAGER = upm" , " UNITY_LOG_CATEGORY=build" ]) {
137
+ jenkins. withCredentials([jenkins. usernamePassword(credentialsId : artifactorySecret, usernameVariable : " UPM_USERNAME" , passwordVariable : " UPM_PASSWORD" ),
138
+ jenkins. usernameColonPassword(credentialsId : artifactorySecret, variable : " NUGET_KEY" ),
139
+ jenkins. usernameColonPassword(credentialsId : artifactorySecret, variable : " nugetkey" )]) {
113
140
114
141
115
- gradle. wrapper(" publish " +
116
- " -Ppaket.publish.repository='${ releaseType} ' " +
117
- " -Ppublish.repository='${ releaseType} ' " +
118
- " -PversionBuilder.stage=${ releaseType} " +
119
- " -PversionBuilder.scope=${ releaseScope} " )
142
+ gradle. wrapper(" publish " +
143
+ " -Ppaket.publish.repository='${ releaseType} ' " +
144
+ " -Ppublish.repository='${ releaseType} ' " +
145
+ " -PversionBuilder.stage=${ releaseType} " +
146
+ " -PversionBuilder.scope=${ releaseScope} " )
147
+ }
120
148
}
121
149
}
122
150
}
0 commit comments