Skip to content

Import public GPG key #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ function gpg_import() {
keyId=$(gpg "${@}" --batch --import "$privateKeyPath" 2>&1 | tee >(cat 1>&2) | grep 'key.*: secret key imported' | sed -E 's/.*key ([^:]+):.*/\1/')
# output the fingerprint of the imported key
gpg "${@}" --list-secret-keys --with-colon "$keyId" | sed -E '2!d;s/.*:([^:]+):$/\1/'
export JRELEASER_GPG_KEYNAME=$keyId
}

function gpg_delete() {
Expand All @@ -154,6 +153,12 @@ function gpg_delete() {
gpg "${@}" --batch --yes --delete-secret-keys "$fingerprint"
}

function gpg_delete_public() {
local fingerprint="$1"
shift
gpg "${@}" --batch --yes --delete-keys "$fingerprint"
}

#--------------------------------------------
# Cleanup on exit

Expand All @@ -162,6 +167,10 @@ function cleanup() {
echo "Deleting imported GPG private key..."
gpg_delete "$IMPORTED_KEY" || true
fi
if [ -n "$IMPORTED_PUBLIC_KEY" ]; then
echo "Deleting imported GPG public key..."
gpg_delete_public "$IMPORTED_PUBLIC_KEY" || true
fi
if [ -d "$RELEASE_GPG_HOMEDIR" ]; then
echo "Cleaning up GPG homedir..."
rm -rf "$RELEASE_GPG_HOMEDIR" || true
Expand All @@ -186,6 +195,7 @@ if [ -z "$IMPORTED_KEY" ]; then
echo "Failed to import GPG key"
exit 1
fi
IMPORTED_PUBLIC_KEY="$(gpg_import "$RELEASE_GPG_PUBLIC_KEY_PATH")"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marko-bekhta Won't this fail on any other project where the env variable is not set? If so you just broke the release process of Search/Validator/others. Fortunately not ORM/Reactive since they don't use this script AFAIK.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, I thought I had it as "conditional" ... but in the end it turned out to be useless, so I'll revert this change with the next update. We are looking with Andrea into hibernate-models and that would require some updates to the release scripts (so will include it there) 🙈 sorry


if [ "$PUSH_CHANGES" != "true" ]; then
ADDITIONAL_OPTIONS="-d"
Expand Down