Skip to content

Commit d4628eb

Browse files
committed
Bump version to 0.3.24 and enhance GPG key import process in release workflow
1 parent 5c78755 commit d4628eb

File tree

2 files changed

+35
-11
lines changed

2 files changed

+35
-11
lines changed

.github/workflows/release.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,15 @@ jobs:
156156
- name: Import GPG key
157157
run: |
158158
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
160168
161169
# List keys to verify import
162170
echo "Imported GPG keys:"
@@ -168,18 +176,23 @@ jobs:
168176
169177
if gpg --list-secret-keys $GPG_KEY_ID >/dev/null 2>&1; then
170178
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
171191
else
172192
echo "✗ Key $GPG_KEY_ID not found in keyring"
173193
echo "Available keys:"
174194
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
183196
fi
184197
185198
- name: Publish to Maven Central

build.gradle.kts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ plugins {
1515
}
1616

1717
group = "io.github.clojang"
18-
version = "0.3.23"
18+
version = "0.3.24"
1919

2020
// Make version catalog values available via ext properties
2121
ext {
@@ -197,7 +197,18 @@ signing {
197197

198198
// Only configure signing if all required properties are present
199199
if (!signingKeyId.isNullOrEmpty() && !signingKey.isNullOrEmpty() && !signingPassword.isNullOrEmpty()) {
200-
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
200+
println("Configuring in-memory PGP signing with key ID: $signingKeyId")
201+
202+
try {
203+
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
204+
println("✓ In-memory PGP keys configured successfully")
205+
} catch (e: Exception) {
206+
println("✗ Failed to configure in-memory PGP keys: ${e.message}")
207+
// Try alternative approach - set as properties and let Gradle handle it
208+
project.ext["signing.keyId"] = signingKeyId
209+
project.ext["signing.password"] = signingPassword
210+
project.ext["signing.secretKeyRingFile"] = null // Force in-memory mode
211+
}
201212

202213
// Sign all publications after they're created
203214
afterEvaluate {

0 commit comments

Comments
 (0)