@@ -15,6 +15,13 @@ image: objectboxio/buildenv-core:2024-07-11 # With JDK 17
1515# - ORG_GRADLE_PROJECT_signingPassword
1616
1717variables :
18+ OBX_RELEASE :
19+ value : " false"
20+ options : [ "false", "true" ]
21+ description : " Turns on the release flag in the Gradle root build script, which triggers building and publishing a
22+ release of Java libraries to the internal GitLab repository and Maven Central.
23+ Consult the release checklist before turning this on."
24+
1825 # Disable the Gradle daemon. Gradle may run in a Docker container with a shared
1926 # Docker volume containing GRADLE_USER_HOME. If the container is stopped after a job
2027 # Gradle daemons may get killed, preventing proper clean-up of lock files in GRADLE_USER_HOME.
@@ -173,16 +180,16 @@ publish-maven-internal:
173180 script :
174181 - ./gradlew $GITLAB_REPO_ARGS $GITLAB_PUBLISH_ARGS $VERSION_ARGS publishMavenJavaPublicationToGitLabRepository
175182
176- # Publish Maven artifacts to public Maven repo at Central
183+ # Publish Maven artifacts to public Maven Central repo
177184publish-maven-central :
178185 stage : publish-maven-central
179186 tags :
180187 - docker
181188 - linux
182189 - x64
183190 rules :
184- # Only on publish branch , only if no previous stages failed
185- - if : $CI_COMMIT_BRANCH == "publish "
191+ # Only if release mode is on , only if no previous stages failed
192+ - if : $OBX_RELEASE == "true "
186193 when : on_success
187194 before_script :
188195 - ci/send-to-gchat.sh "$GOOGLE_CHAT_WEBHOOK_JAVA_CI" --thread $CI_COMMIT_SHA "*Releasing Java library:* job $CI_JOB_NAME from branch $CI_COMMIT_BRANCH ($CI_COMMIT_SHORT_SHA)..."
@@ -202,8 +209,8 @@ package-api-docs:
202209 - linux
203210 - x64
204211 rules :
205- # Only on publish branch , only if no previous stages failed
206- - if : $CI_COMMIT_BRANCH == "publish "
212+ # Only if release mode is on , only if no previous stages failed
213+ - if : $OBX_RELEASE == "true "
207214 when : on_success
208215 script :
209216 - ./gradlew $GITLAB_REPO_ARGS $VERSION_ARGS :objectbox-java:packageJavadocForWeb
@@ -217,6 +224,9 @@ package-api-docs:
217224trigger-plugin :
218225 stage : triggers
219226 rules :
227+ # Not when publishing a release
228+ - if : $OBX_RELEASE == "true"
229+ when : never
220230 # Do not trigger publishing of plugin
221231 - if : $CI_COMMIT_BRANCH == "publish"
222232 when : never
0 commit comments