Set the correct JVM before publishing PolyGerrit artifacts

The publishing of PolyGerrit artifacts involves an execution
of Bazelisk that would need the correct JVM context for assuring
that the Bazel runtime is reused.

Change-Id: Ia148a23ace9eb6d7739a391aa513f79f68168f79
diff --git a/vars/pluginPipeline.groovy b/vars/pluginPipeline.groovy
index d9bfaf8..edd8b19 100644
--- a/vars/pluginPipeline.groovy
+++ b/vars/pluginPipeline.groovy
@@ -113,7 +113,7 @@
                             (extraPlugins + extraModules + extraGhRepos).each { plugin -> sh "cd plugins && ln -s ../../${plugin} ." }
                         }
                         sh "${bazeliskCmd} build ${bazeliskOptions} gerrit"
-                        sh "./polygerrit-ui/app/api/publish.sh --pack"
+                        sh "#!/bin/bash\n" + ". set-java.sh --branch $GERRIT_BRANCH && ./polygerrit-ui/app/api/publish.sh --pack"
                         sh "${bazeliskCmd} build ${bazeliskOptions} plugins/${pluginName}/..."
                         sh "${bazeliskCmd} test ${bazeliskOptions} --test_env DOCKER_HOST=" + '$DOCKER_HOST' + " plugins/${pluginName}/..."
                     }