@@ -216,48 +216,52 @@ EOL
216216
217217 # --== GPG SETUP ==--
218218
219- # Install GPG on macOS
220- if [ " $platform " = Darwin ]; then
221- HOMEBREW_NO_AUTO_UPDATE=1 brew install gnupg2
222- fi
223-
224- # Avoid "signing failed: Inappropriate ioctl for device" error.
225- export GPG_TTY=$( tty)
226-
227- # Import the GPG signing key.
228- keyFile=.ci/signingkey.asc
229- if [ " $deployOK " ]; then
230- echo " == Importing GPG keypair =="
231- mkdir -p .ci
232- echo " $SIGNING_ASC " > " $keyFile "
233- ls -la " $keyFile "
234- gpg --version
235- gpg --batch --fast-import " $keyFile "
236- checkSuccess $?
237- fi
219+ if [ " $GPG_KEY_NAME " -a " $GPG_PASSPHRASE " ]; then
220+ # Install GPG on macOS
221+ if [ " $platform " = Darwin ]; then
222+ HOMEBREW_NO_AUTO_UPDATE=1 brew install gnupg2
223+ fi
238224
239- # HACK: Use maven-gpg-plugin 3.0.1+. Avoids "signing failed: No such file or directory" error.
240- maven_gpg_plugin_version=$( mavenEvaluate ' ${maven-gpg-plugin.version}' )
241- case " $maven_gpg_plugin_version " in
242- 0.* |1.* |2.* |3.0.0)
243- echo " --> Forcing maven-gpg-plugin version from $maven_gpg_plugin_version to 3.0.1"
244- BUILD_ARGS=" $BUILD_ARGS -Dmaven-gpg-plugin.version=3.0.1 -Darguments=-Dmaven-gpg-plugin.version=3.0.1"
245- ;;
246- * )
247- echo " --> maven-gpg-plugin version OK: $maven_gpg_plugin_version "
248- ;;
249- esac
250-
251- # HACK: Install pinentry helper program if missing. Avoids "signing failed: No pinentry" error.
252- if ! which pinentry > /dev/null 2>&1 ; then
253- echo ' --> Installing missing pinentry helper for GPG'
254- sudo apt-get install -y pinentry-tty
255- # HACK: Restart the gpg agent, to notice the newly installed pinentry.
256- if { pgrep gpg-agent > /dev/null && which gpgconf > /dev/null 2>&1 ; } then
257- echo ' --> Restarting gpg-agent'
258- gpgconf --reload gpg-agent
225+ # Avoid "signing failed: Inappropriate ioctl for device" error.
226+ export GPG_TTY=$( tty)
227+
228+ # Import the GPG signing key.
229+ keyFile=.ci/signingkey.asc
230+ if [ " $deployOK " ]; then
231+ echo " == Importing GPG keypair =="
232+ mkdir -p .ci
233+ echo " $SIGNING_ASC " > " $keyFile "
234+ ls -la " $keyFile "
235+ gpg --version
236+ gpg --batch --fast-import " $keyFile "
259237 checkSuccess $?
260238 fi
239+
240+ # HACK: Use maven-gpg-plugin 3.0.1+. Avoids "signing failed: No such file or directory" error.
241+ maven_gpg_plugin_version=$( mavenEvaluate ' ${maven-gpg-plugin.version}' )
242+ case " $maven_gpg_plugin_version " in
243+ 0.* |1.* |2.* |3.0.0)
244+ echo " --> Forcing maven-gpg-plugin version from $maven_gpg_plugin_version to 3.0.1"
245+ BUILD_ARGS=" $BUILD_ARGS -Dmaven-gpg-plugin.version=3.0.1 -Darguments=-Dmaven-gpg-plugin.version=3.0.1"
246+ ;;
247+ * )
248+ echo " --> maven-gpg-plugin version OK: $maven_gpg_plugin_version "
249+ ;;
250+ esac
251+
252+ # HACK: Install pinentry helper program if missing. Avoids "signing failed: No pinentry" error.
253+ if ! which pinentry > /dev/null 2>&1 ; then
254+ echo ' --> Installing missing pinentry helper for GPG'
255+ sudo apt-get install -y pinentry-tty
256+ # HACK: Restart the gpg agent, to notice the newly installed pinentry.
257+ if { pgrep gpg-agent > /dev/null && which gpgconf > /dev/null 2>&1 ; } then
258+ echo ' --> Restarting gpg-agent'
259+ gpgconf --reload gpg-agent
260+ checkSuccess $?
261+ fi
262+ fi
263+ else
264+ echo " [WARNING] Skipping gpg setup (no GPG credentials)."
261265 fi
262266
263267 # --== BUILD EXECUTION ==--
0 commit comments