@@ -28,8 +28,8 @@ variables:
28
28
# Using multiple test stages to avoid running some things in parallel (see job notes).
29
29
stages :
30
30
- test
31
- - upload-to -internal
32
- - upload-to -central
31
+ - publish-maven -internal
32
+ - publish-maven -central
33
33
- package-api-docs
34
34
- triggers
35
35
@@ -120,22 +120,35 @@ test-jdk-x86:
120
120
TEST_WITH_JAVA_X86 : " true"
121
121
script : ./gradlew $GITLAB_REPO_ARGS $VERSION_ARGS clean build
122
122
123
- upload-to-internal :
124
- stage : upload-to-internal
123
+ # Publish Maven artifacts to internal Maven repo
124
+ publish-maven-internal :
125
+ stage : publish-maven-internal
125
126
tags : [ docker, x64 ]
126
- except :
127
- - main # Do not upload duplicate release artifacts
128
- - pipelines # Do not upload artifacts if triggered by upstream project to save on disk space
129
- - schedules # Do not upload artifacts from scheduled jobs to save on disk space
130
- - tags # Only upload artifacts from branches
127
+ rules :
128
+ # Not from main branch, doing so may duplicate release artifacts (uploaded from publish branch)
129
+ - if : $CI_COMMIT_BRANCH == "main"
130
+ when : never
131
+ # Not if triggered by upstream project to save on disk space
132
+ - if : $CI_PIPELINE_SOURCE == "pipeline"
133
+ when : never
134
+ # Not from scheduled pipelines to save on disk space
135
+ - if : $CI_PIPELINE_SOURCE == "schedule"
136
+ when : never
137
+ # Not from tags
138
+ - if : $CI_COMMIT_TAG == null
139
+ when : never
140
+ # Otherwise, only on push to branch
141
+ - if : $CI_PIPELINE_SOURCE == "push"
131
142
script :
132
143
- ./gradlew $GITLAB_REPO_ARGS $GITLAB_PUBLISH_ARGS $VERSION_ARGS publishMavenJavaPublicationToGitLabRepository
133
144
134
- upload-to-central :
135
- stage : upload-to-central
145
+ # Publish Maven artifacts to public Maven repo at Central
146
+ publish-maven-central :
147
+ stage : publish-maven-central
136
148
tags : [ docker, x64 ]
137
- only :
138
- - publish
149
+ rules :
150
+ # Only on publish branch
151
+ - if : $CI_COMMIT_BRANCH == "publish"
139
152
before_script :
140
153
- 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)..."
141
154
script :
@@ -146,11 +159,13 @@ upload-to-central:
146
159
- ci/send-to-gchat.sh "$GOOGLE_CHAT_WEBHOOK_JAVA_CI" --thread $CI_COMMIT_SHA "*Releasing Java library:* *$CI_JOB_STATUS* for $CI_JOB_NAME"
147
160
- ci/send-to-gchat.sh "$GOOGLE_CHAT_WEBHOOK_JAVA_CI" --thread $CI_COMMIT_SHA "Check https://repo1.maven.org/maven2/io/objectbox/ in a few minutes."
148
161
162
+ # Create Java API docs archive
149
163
package-api-docs :
150
164
stage : package-api-docs
151
165
tags : [ docker, x64 ]
152
- only :
153
- - publish
166
+ rules :
167
+ # Only on publish branch
168
+ - if : $CI_COMMIT_BRANCH == "publish"
154
169
script :
155
170
- ./gradlew $GITLAB_REPO_ARGS $VERSION_ARGS :objectbox-java:packageJavadocForWeb
156
171
after_script :
@@ -159,14 +174,18 @@ package-api-docs:
159
174
paths :
160
175
- " objectbox-java/build/dist/objectbox-java-web-api-docs.zip"
161
176
177
+ # Trigger Gradle plugin build to test new Maven snapshots of this project
162
178
trigger-plugin :
163
179
stage : triggers
164
- except :
165
- - schedules # Do not trigger when run on schedule, e.g. integ tests have own schedule.
166
- - publish
180
+ rules :
181
+ # Do not trigger publishing of plugin
182
+ - if : $CI_COMMIT_BRANCH == "publish"
183
+ when : never
184
+ # Otherwise, only on push to branch (also set allow_failure in case branch does not exist downstream)
185
+ - if : $CI_PIPELINE_SOURCE == "push"
167
186
inherit :
168
187
variables : false
169
- allow_failure : true # Branch might not exist, yet, in plugin project.
188
+ allow_failure : true # Branch might not exist in plugin project
170
189
trigger :
171
190
project : objectbox/objectbox-plugin
172
191
branch : $CI_COMMIT_BRANCH
0 commit comments