Skip to content

Commit 8bc3bcc

Browse files
committed
debugging key import
1 parent 023f6d4 commit 8bc3bcc

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.github/workflows/maven-publish.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,29 @@ jobs:
2727
- name: Import GPG key
2828
run: |
2929
# Write key to file to handle multiline content properly
30-
echo "${{ secrets.OSSRH_GPG_SECRET_KEY }}" > "$RUNNER_TEMP/private-key.asc"
30+
cat <<'EOF' > "$RUNNER_TEMP/private-key.asc"
31+
${{ secrets.OSSRH_GPG_SECRET_KEY }}
32+
EOF
3133
32-
# Show what we're trying to import (first/last lines only for security)
33-
echo "First line of key file:"
34-
head -n 1 "$RUNNER_TEMP/private-key.asc"
35-
echo "Last line of key file:"
36-
tail -n 1 "$RUNNER_TEMP/private-key.asc"
34+
# Check file info (size won't be masked)
35+
echo "Key file size: $(wc -c < "$RUNNER_TEMP/private-key.asc") bytes"
36+
echo "Key file lines: $(wc -l < "$RUNNER_TEMP/private-key.asc") lines"
37+
38+
# Check if it looks like a PGP key
39+
if grep -q "BEGIN PGP PRIVATE KEY BLOCK" "$RUNNER_TEMP/private-key.asc"; then
40+
echo "✓ File contains PGP key header"
41+
else
42+
echo "✗ File does NOT contain PGP key header!"
43+
echo "Your OSSRH_GPG_SECRET_KEY secret is not in the correct format."
44+
echo "It should start with: -----BEGIN PGP PRIVATE KEY BLOCK-----"
45+
exit 1
46+
fi
3747
3848
# Import the key
3949
gpg --batch --import "$RUNNER_TEMP/private-key.asc"
4050
4151
# List imported keys
52+
echo "Successfully imported keys:"
4253
gpg --list-secret-keys --keyid-format LONG
4354
4455
# Clean up

0 commit comments

Comments
 (0)