Skip to content

Commit 5988fe8

Browse files
Merge branch 'refs/heads/main' into dev
2 parents 5e10e95 + 724275c commit 5988fe8

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ upload-to-internal:
124124
except:
125125
- tags # Only publish from branches.
126126
- schedules # Do not publish artifacts from scheduled jobs to save on disk space.
127+
- main # Do not overwrite release artifacts.
127128
script:
128129
- ./gradlew $GITLAB_REPO_ARGS $VERSION_ARGS publishMavenJavaPublicationToGitLabRepository
129130

build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ buildscript {
1818
val objectboxVersionRelease =
1919
false // set to true for releasing to ignore versionPostFix to avoid e.g. "-dev" versions
2020

21+
// To avoid duplicate release artifacts on the internal repository,
22+
// prevent uploading from branches other than publish, and main (for which uploading is turned off).
23+
val isCI = System.getenv("CI") == "true"
24+
val branchOrTag = System.getenv("CI_COMMIT_REF_NAME")
25+
if (isCI && objectboxVersionRelease && !("publish" == branchOrTag || "main" == branchOrTag)) {
26+
throw GradleException("objectboxVersionRelease = true is only allowed on branch publish or main")
27+
}
28+
2129
// version post fix: "-<value>" or "" if not defined; e.g. used by CI to pass in branch name
2230
val versionPostFixValue = project.findProperty("versionPostFix")
2331
val versionPostFix = if (versionPostFixValue != null) "-$versionPostFixValue" else ""

0 commit comments

Comments
 (0)