Skip to content

Commit 9978420

Browse files
LarsEckartJayBazuziisidore
committed
. e script to test keys, ready to test next deploy
Co-authored-by: Jay Bazuzi <[email protected]> Co-authored-by: Llewellyn Falco <[email protected]>
1 parent 42026fb commit 9978420

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

deploy_with_jreleaser.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ echo "********** Setting up gpg"
1616
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
1717

1818
echo "********** Staging artifacts with Maven"
19-
mvn clean deploy -Ppublication -DskipTests
19+
# Get the key ID from the imported key
20+
KEY_ID=$(echo "$GPG_PRIVATE_KEY" | gpg --list-packets 2>/dev/null | grep -E "keyid:" | head -1 | awk '{print $2}')
21+
echo "Using GPG key: $KEY_ID"
22+
mvn clean deploy -Ppublication -DskipTests -Dgpg.keyname="$KEY_ID" -Dgpg.passphrase="$GPG_PASSPHRASE"
2023

2124
echo "********** Setting JReleaser environment variables"
2225
export JRELEASER_MAVENCENTRAL_USERNAME="$MAVEN_USERNAME_2025"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Source the environment
5+
source ./set_enviroment_for_maven.sh
6+
7+
# Import the key and get its ID
8+
echo "$GPG_PRIVATE_KEY" | gpg --batch --import 2>&1 | grep -E "key|imported" || true
9+
10+
# Get the key ID from the imported key
11+
KEY_ID=$(echo "$GPG_PRIVATE_KEY" | gpg --list-packets 2>/dev/null | grep -E "keyid:" | head -1 | awk '{print $2}')
12+
echo "Testing key ID: ${KEY_ID}"
13+
14+
# Test signing with the specific key
15+
if echo "test" | gpg --batch --yes --passphrase "$GPG_PASSPHRASE" --pinentry-mode loopback --armor --default-key "${KEY_ID}" --sign >/dev/null 2>&1; then
16+
echo -e "\n✓ Passphrase is correct for key ${KEY_ID}"
17+
exit 0
18+
else
19+
echo -e "\n✗ Passphrase is incorrect for key ${KEY_ID}"
20+
exit 1
21+
fi

0 commit comments

Comments
 (0)