@@ -145,7 +145,6 @@ function gpg_import() {
145
145
keyId=$( gpg " ${@ } " --batch --import " $privateKeyPath " 2>&1 | tee >( cat 1>&2 ) | grep ' key.*: secret key imported' | sed -E ' s/.*key ([^:]+):.*/\1/' )
146
146
# output the fingerprint of the imported key
147
147
gpg " ${@ } " --list-secret-keys --with-colon " $keyId " | sed -E ' 2!d;s/.*:([^:]+):$/\1/'
148
- export JRELEASER_GPG_KEYNAME=$keyId
149
148
}
150
149
151
150
function gpg_delete() {
@@ -154,6 +153,12 @@ function gpg_delete() {
154
153
gpg " ${@ } " --batch --yes --delete-secret-keys " $fingerprint "
155
154
}
156
155
156
+ function gpg_delete_public() {
157
+ local fingerprint=" $1 "
158
+ shift
159
+ gpg " ${@ } " --batch --yes --delete-keys " $fingerprint "
160
+ }
161
+
157
162
# --------------------------------------------
158
163
# Cleanup on exit
159
164
@@ -162,6 +167,10 @@ function cleanup() {
162
167
echo " Deleting imported GPG private key..."
163
168
gpg_delete " $IMPORTED_KEY " || true
164
169
fi
170
+ if [ -n " $IMPORTED_PUBLIC_KEY " ]; then
171
+ echo " Deleting imported GPG public key..."
172
+ gpg_delete_public " $IMPORTED_PUBLIC_KEY " || true
173
+ fi
165
174
if [ -d " $RELEASE_GPG_HOMEDIR " ]; then
166
175
echo " Cleaning up GPG homedir..."
167
176
rm -rf " $RELEASE_GPG_HOMEDIR " || true
@@ -186,6 +195,7 @@ if [ -z "$IMPORTED_KEY" ]; then
186
195
echo " Failed to import GPG key"
187
196
exit 1
188
197
fi
198
+ IMPORTED_PUBLIC_KEY=" $( gpg_import " $RELEASE_GPG_PUBLIC_KEY_PATH " ) "
189
199
190
200
if [ " $PUSH_CHANGES " != " true" ]; then
191
201
ADDITIONAL_OPTIONS=" -d"
0 commit comments