@@ -22,54 +22,68 @@ 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
- 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} " )
71
+ String signingKeySecret , String signingKeyIdSecret , String signingPassphraseSecret ) {
72
+ String checkTask = conventions. checkTask
73
+ String workingDir = conventions. workingDir
74
+ jenkins. dir(workingDir) {
75
+ def credentials = [
76
+ jenkins. usernamePassword(credentialsId : artifactorySecret,
77
+ usernameVariable : " ARTIFACTORY_USER" ,
78
+ passwordVariable : " ARTIFACTORY_PASS" )
79
+ ] + ossrhSigningCredentials(signingKeySecret, signingKeyIdSecret, signingPassphraseSecret)
80
+ jenkins. withCredentials(credentials) {
81
+ gradle. wrapper(" ${ releaseType} " +
82
+ " -Partifactory.user=${ jenkins.ARTIFACTORY_USER} " +
83
+ " -Partifactory.password=${ jenkins.ARTIFACTORY_PASS} " +
84
+ " -Prelease.stage=${ releaseType} " +
85
+ " -Prelease.scope=${ releaseScope} -x ${ checkTask} " )
86
+ }
73
87
}
74
88
}
75
89
@@ -82,41 +96,54 @@ class Publishers {
82
96
}
83
97
84
98
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} " )
99
+ PipelineConventions conventions = PipelineConventions . standard) {
100
+ String checkTask = conventions. checkTask
101
+ String workingDir = conventions. workingDir
102
+ jenkins. dir(workingDir) {
103
+ jenkins. withEnv([" UNITY_PACKAGE_MANAGER = paket" , " UNITY_PATH=${ unityPath} " , " UNITY_LOG_CATEGORY=build" ]) {
104
+ jenkins. withCredentials([jenkins. usernameColonPassword(credentialsId : artifactorySecret, variable : " NUGET_KEY" ),
105
+ jenkins. usernameColonPassword(credentialsId : artifactorySecret, variable : " nugetkey" )]) {
106
+ gradle. wrapper(" ${ releaseType} " +
107
+ " -Prelease.stage=${ releaseType} " +
108
+ " -Ppaket.publish.repository='${ releaseType} ' " +
109
+ " -Prelease.scope=${ releaseScope} -x ${ checkTask} " )
110
+ }
93
111
}
94
112
}
95
113
}
96
114
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" )
115
+ def npm (String npmCredsSecret ,
116
+ PipelineConventions conventions = PipelineConventions . standard) {
117
+ String checkTask = conventions. checkTask
118
+ String workingDir = conventions. workingDir
119
+ jenkins. dir(workingDir) {
120
+ def credentials = [
121
+ jenkins. usernamePassword(credentialsId : npmCredsSecret,
122
+ usernameVariable : " NODE_RELEASE_NPM_USER" ,
123
+ passwordVariable : " NODE_RELEASE_NPM_PASS" )
124
+ ]
125
+ jenkins. withCredentials(credentials) {
126
+ gradle. wrapper(" ${ releaseType} -Prelease.stage=${ releaseType} -Prelease.scope=${ releaseScope} -x ${ checkTask} " )
127
+ }
105
128
}
106
129
}
107
130
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" )]) {
131
+ def unityArtifactoryUpm (String artifactorySecret ,
132
+ PipelineConventions conventions = PipelineConventions . standard) {
133
+ String workingDir = conventions. workingDir
134
+ jenkins. dir(workingDir) {
135
+ jenkins. withEnv([" UNITY_PACKAGE_MANAGER = upm" , " UNITY_LOG_CATEGORY=build" ]) {
136
+ jenkins. withCredentials([jenkins. usernamePassword(credentialsId : artifactorySecret, usernameVariable : " UPM_USERNAME" , passwordVariable : " UPM_PASSWORD" ),
137
+ jenkins. usernameColonPassword(credentialsId : artifactorySecret, variable : " NUGET_KEY" ),
138
+ jenkins. usernameColonPassword(credentialsId : artifactorySecret, variable : " nugetkey" )]) {
113
139
114
140
115
- gradle. wrapper(" publish " +
116
- " -Ppaket.publish.repository='${ releaseType} ' " +
117
- " -Ppublish.repository='${ releaseType} ' " +
118
- " -PversionBuilder.stage=${ releaseType} " +
119
- " -PversionBuilder.scope=${ releaseScope} " )
141
+ gradle. wrapper(" publish " +
142
+ " -Ppaket.publish.repository='${ releaseType} ' " +
143
+ " -Ppublish.repository='${ releaseType} ' " +
144
+ " -PversionBuilder.stage=${ releaseType} " +
145
+ " -PversionBuilder.scope=${ releaseScope} " )
146
+ }
120
147
}
121
148
}
122
149
}
0 commit comments