Skip to content

Commit 6c0b67e

Browse files
committed
Updated publish.yml
1 parent 1ff8b39 commit 6c0b67e

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

.github/workflows/publish.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,57 @@ name: Publish
22
on:
33
release:
44
types: [released, prereleased]
5+
56
jobs:
67
publish:
78
name: Release build and publish
89
runs-on: macOS-latest
910
steps:
1011
- name: Check out code
1112
uses: actions/checkout@v4
13+
1214
- name: Set up JDK 21
1315
uses: actions/setup-java@v4
1416
with:
1517
distribution: 'zulu'
1618
java-version: 21
17-
- name: Publish to MavenCentral
18-
run: ./gradlew publishToMavenCentral --no-configuration-cache
19+
20+
- name: Debug: Check secrets lengths
21+
run: |
22+
echo "MAVEN_CENTRAL_USERNAME length: $(echo -n "$ORG_GRADLE_PROJECT_mavenCentralUsername" | wc -c)"
23+
echo "MAVEN_CENTRAL_PASSWORD length: $(echo -n "$ORG_GRADLE_PROJECT_mavenCentralPassword" | wc -c)"
24+
echo "SIGNING_KEY_ID length: $(echo -n "$ORG_GRADLE_PROJECT_signingInMemoryKeyId" | wc -c)"
25+
echo "SIGNING_PASSWORD length: $(echo -n "$ORG_GRADLE_PROJECT_signingInMemoryKeyPassword" | wc -c)"
26+
echo "GPG_KEY_CONTENTS length: $(echo -n "$ORG_GRADLE_PROJECT_signingInMemoryKey" | wc -c)"
1927
env:
2028
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
2129
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
2230
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
2331
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
24-
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }}
32+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }}
33+
34+
- name: Publish to MavenCentral with Debug Logs
35+
run: |
36+
echo "Starting Publish to MavenCentral"
37+
# Write the base64-encoded GPG key to a file
38+
echo "$ORG_GRADLE_PROJECT_signingInMemoryKey" > encoded.key
39+
encoded_length=$(wc -c < encoded.key)
40+
echo "Encoded key length: $encoded_length"
41+
42+
# Decode the key (macOS uses -D for decode)
43+
base64 -D -i encoded.key -o decoded.key || { echo "Error decoding base64 key"; exit 1; }
44+
decoded_length=$(wc -c < decoded.key)
45+
echo "Decoded key length: $decoded_length"
46+
47+
# Export the decoded key for Gradle's in-memory signing
48+
export ORG_GRADLE_PROJECT_signingInMemoryKey="$(cat decoded.key)"
49+
echo "Exported signingInMemoryKey length: $(echo "$ORG_GRADLE_PROJECT_signingInMemoryKey" | wc -c)"
50+
51+
# Run Gradle with detailed logs and disable configuration cache
52+
./gradlew publishToMavenCentral --no-configuration-cache --info
53+
env:
54+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
55+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
56+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
57+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
58+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }}

0 commit comments

Comments
 (0)