@@ -156,7 +156,15 @@ jobs:
156
156
- name : Import GPG key
157
157
run : |
158
158
echo "Importing GPG key..."
159
- echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import --quiet
159
+
160
+ # Create a temporary file for the key to avoid shell escaping issues
161
+ echo "${{ secrets.GPG_PRIVATE_KEY }}" > /tmp/private.key
162
+
163
+ # Import the key
164
+ gpg --batch --import /tmp/private.key
165
+
166
+ # Clean up the temporary file
167
+ rm /tmp/private.key
160
168
161
169
# List keys to verify import
162
170
echo "Imported GPG keys:"
@@ -168,18 +176,23 @@ jobs:
168
176
169
177
if gpg --list-secret-keys $GPG_KEY_ID >/dev/null 2>&1; then
170
178
echo "✓ Key $GPG_KEY_ID found in keyring"
179
+
180
+ # Test exporting the key in the format Gradle expects
181
+ echo "Testing key export for Gradle..."
182
+ gpg --export-secret-keys --armor $GPG_KEY_ID > /tmp/exported_key.asc
183
+
184
+ echo "Exported key length: $(wc -c < /tmp/exported_key.asc)"
185
+ echo "First few lines of exported key:"
186
+ head -3 /tmp/exported_key.asc
187
+ echo "Last few lines of exported key:"
188
+ tail -3 /tmp/exported_key.asc
189
+
190
+ rm /tmp/exported_key.asc
171
191
else
172
192
echo "✗ Key $GPG_KEY_ID not found in keyring"
173
193
echo "Available keys:"
174
194
gpg --list-secret-keys --keyid-format SHORT
175
- fi
176
-
177
- # Test that we can export the key (this is what Gradle will try to do)
178
- echo "Testing key export..."
179
- if gpg --export-secret-keys --armor $GPG_KEY_ID >/dev/null 2>&1; then
180
- echo "✓ Key export test successful"
181
- else
182
- echo "✗ Key export test failed"
195
+ exit 1
183
196
fi
184
197
185
198
- name : Publish to Maven Central
0 commit comments