File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ echo "********** Setting up gpg"
1616echo " $GPG_PRIVATE_KEY " | gpg --batch --import
1717
1818echo " ********** 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
2124echo " ********** Setting JReleaser environment variables"
2225export JRELEASER_MAVENCENTRAL_USERNAME=" $MAVEN_USERNAME_2025 "
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments