Skip to content

Commit 27686d4

Browse files
committed
Try base64 encoding the nexus password also.
1 parent a0a35b2 commit 27686d4

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
env:
3030
gh_token: ${{ secrets.GH_TOKEN }}
3131
ORG_GRADLE_PROJECT_nexus_user: ${{ secrets.NEXUS_USER }}
32-
ORG_GRADLE_PROJECT_nexus_pass: ${{ secrets.NEXUS_PASS }}
32+
ORG_GRADLE_PROJECT_nexus_pass64: ${{ secrets.NEXUS_PASS64 }}
3333
ORG_GRADLE_PROJECT_gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
3434
ORG_GRADLE_PROJECT_gpg_key64: ${{ secrets.GPG_KEY64 }}
3535
steps:

gradle/java-publish.gradle

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
import java.nio.charset.StandardCharsets
2+
3+
def decode64(String varNam) {
4+
String envValue = System.env['ORG_GRADLE_PROJECT_nexus_user']
5+
if (envValue == null) {
6+
return ""
7+
} else {
8+
return new String(envValue.decodeBase64(), "UTF-8")
9+
}
10+
}
111

212
if (project.parent == null) {
313
group = 'com.diffplug.spotless'
14+
def pass = System.env['ORG_GRADLE_PROJECT_nexus_pass64']
15+
if (pass != null) {
16+
pass = pass.decodeBase64()
17+
}
418
// it's the root project
519
apply plugin: 'io.github.gradle-nexus.publish-plugin'
620
nexusPublishing {
@@ -9,7 +23,7 @@ if (project.parent == null) {
923
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
1024
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
1125
username = System.env['ORG_GRADLE_PROJECT_nexus_user']
12-
password = System.env['ORG_GRADLE_PROJECT_nexus_pass']
26+
password = decode64('ORG_GRADLE_PROJECT_nexus_pass64')
1327
}
1428
}
1529
}
@@ -158,7 +172,7 @@ model {
158172

159173
if (!version.endsWith('-SNAPSHOT')) {
160174
signing {
161-
String gpg_key = new String(System.env['ORG_GRADLE_PROJECT_gpg_key64'].decodeBase64())
175+
String gpg_key = decode64('ORG_GRADLE_PROJECT_gpg_key64')
162176
useInMemoryPgpKeys(gpg_key, System.env['ORG_GRADLE_PROJECT_gpg_passphrase'])
163177
sign(publishing.publications)
164178
}

0 commit comments

Comments
 (0)