Skip to content

Commit ccc3ec4

Browse files
GitLab CI: never create pipelines when tags are pushed
1 parent 20017ee commit ccc3ec4

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

.gitlab-ci.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ stages:
3333
- package-api-docs
3434
- triggers
3535

36+
workflow:
37+
rules:
38+
# Never create a pipeline when a tag is pushed (to simplify release checks in root build script)
39+
- if: $CI_COMMIT_TAG
40+
when: never
41+
# Otherwise, only create a pipeline when a branch is pushed
42+
- if: $CI_PIPELINE_SOURCE == "push"
43+
3644
test:
3745
stage: test
3846
tags: [ docker, linux, x64 ]
@@ -134,9 +142,6 @@ publish-maven-internal:
134142
# Not from scheduled pipelines to save on disk space
135143
- if: $CI_PIPELINE_SOURCE == "schedule"
136144
when: never
137-
# Not from tags
138-
- if: $CI_COMMIT_TAG == null
139-
when: never
140145
# Otherwise, only on push to branch
141146
- if: $CI_PIPELINE_SOURCE == "push"
142147
script:

build.gradle.kts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ buildscript {
3535
}
3636
val obxJniLibVersion by extra("io.objectbox:objectbox-$objectboxPlatform:$nativeVersion")
3737

38+
println("version=$obxJavaVersion")
39+
println("objectboxNativeDependency=$obxJniLibVersion")
40+
41+
// To avoid duplicate release artifacts on the internal repository,
42+
// prevent publishing from branches other than publish, and main (for which publishing is turned off).
43+
val isCI = System.getenv("CI") == "true"
44+
val branchOrTag = System.getenv("CI_COMMIT_REF_NAME")
45+
if (isCI && isRelease && !("publish" == branchOrTag || "main" == branchOrTag)) {
46+
throw GradleException("isRelease = true only allowed on publish or main branch, but is $branchOrTag")
47+
}
48+
49+
// Versions for third party dependencies and plugins
3850
val essentialsVersion by extra("3.1.0")
3951
val junitVersion by extra("4.13.2")
4052
val mockitoVersion by extra("3.8.0")
@@ -47,17 +59,6 @@ buildscript {
4759
val coroutinesVersion by extra("1.7.3")
4860
val dokkaVersion by extra("1.8.20")
4961

50-
println("version=$obxJavaVersion")
51-
println("objectboxNativeDependency=$obxJniLibVersion")
52-
53-
// To avoid duplicate release artifacts on the internal repository,
54-
// prevent uploading from branches other than publish, and main (for which uploading is turned off).
55-
val isCI = System.getenv("CI") == "true"
56-
val branchOrTag = System.getenv("CI_COMMIT_REF_NAME")
57-
if (isCI && isRelease && !("publish" == branchOrTag || "main" == branchOrTag)) {
58-
throw GradleException("isRelease = true is only allowed on branch publish or main")
59-
}
60-
6162
repositories {
6263
mavenCentral()
6364
maven {

0 commit comments

Comments
 (0)