@@ -34,11 +34,14 @@ stages:
34
34
35
35
workflow :
36
36
rules :
37
- # Never create a pipeline when a tag is pushed (to simplify release checks in root build script)
37
+ # Disable merge request pipelines https://docs.gitlab.com/ci/jobs/job_rules/#ci_pipeline_source-predefined-variable
38
+ - if : $CI_PIPELINE_SOURCE == "merge_request_event"
39
+ when : never
40
+ # Never create a pipeline when a tag is pushed (to simplify version computation in root build script)
38
41
- if : $CI_COMMIT_TAG
39
42
when : never
40
- # Otherwise, only create a pipeline when a branch is pushed
41
- - if : $CI_PIPELINE_SOURCE == "push"
43
+ # In all other cases, create a pipeline
44
+ - when : always
42
45
43
46
test :
44
47
stage : test
@@ -134,17 +137,17 @@ publish-maven-internal:
134
137
stage : publish-maven-internal
135
138
tags : [ docker, x64 ]
136
139
rules :
137
- # Not from main branch, doing so may duplicate release artifacts (uploaded from publish branch)
140
+ # Not for main branch, doing so may duplicate release artifacts (uploaded from publish branch)
138
141
- if : $CI_COMMIT_BRANCH == "main"
139
142
when : never
140
143
# Not if triggered by upstream project to save on disk space
141
144
- if : $CI_PIPELINE_SOURCE == "pipeline"
142
145
when : never
143
- # Not from scheduled pipelines to save on disk space
146
+ # Not for scheduled pipelines to save on disk space
144
147
- if : $CI_PIPELINE_SOURCE == "schedule"
145
148
when : never
146
- # Otherwise, only on push to branch
147
- - if : $CI_PIPELINE_SOURCE == "push"
149
+ # Otherwise, only if no previous stages failed
150
+ - when : on_success
148
151
script :
149
152
- ./gradlew $GITLAB_REPO_ARGS $GITLAB_PUBLISH_ARGS $VERSION_ARGS publishMavenJavaPublicationToGitLabRepository
150
153
@@ -153,8 +156,9 @@ publish-maven-central:
153
156
stage : publish-maven-central
154
157
tags : [ docker, x64 ]
155
158
rules :
156
- # Only on publish branch
159
+ # Only on publish branch, only if no previous stages failed
157
160
- if : $CI_COMMIT_BRANCH == "publish"
161
+ when : on_success
158
162
before_script :
159
163
- 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)..."
160
164
script :
@@ -170,8 +174,9 @@ package-api-docs:
170
174
stage : package-api-docs
171
175
tags : [ docker, x64 ]
172
176
rules :
173
- # Only on publish branch
177
+ # Only on publish branch, only if no previous stages failed
174
178
- if : $CI_COMMIT_BRANCH == "publish"
179
+ when : on_success
175
180
script :
176
181
- ./gradlew $GITLAB_REPO_ARGS $VERSION_ARGS :objectbox-java:packageJavadocForWeb
177
182
after_script :
@@ -187,8 +192,8 @@ trigger-plugin:
187
192
# Do not trigger publishing of plugin
188
193
- if : $CI_COMMIT_BRANCH == "publish"
189
194
when : never
190
- # Otherwise, only on push to branch (also set allow_failure in case branch does not exist downstream)
191
- - if : $CI_PIPELINE_SOURCE == "push"
195
+ # Otherwise, only if no previous stages failed. Also set allow_failure in case branch does not exist downstream.
196
+ - when : on_success
192
197
inherit :
193
198
variables : false
194
199
allow_failure : true # Branch might not exist in plugin project
0 commit comments