File tree Expand file tree Collapse file tree 4 files changed +34
-5
lines changed Expand file tree Collapse file tree 4 files changed +34
-5
lines changed Original file line number Diff line number Diff line change 25
25
gpg-passphrase : ${{ secrets.GPG_PASSPHRASE }}
26
26
27
27
- name : Publish to Maven Central
28
- run : ./gradlew publish --no-daemon
28
+ run : ./gradlew check publish -Prelease --no-daemon
29
29
env :
30
30
GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
31
31
GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
Original file line number Diff line number Diff line change 26
26
gpg-passphrase : ${{ secrets.GPG_PASSPHRASE }}
27
27
28
28
- name : Publish Snapshot artifact
29
- run : ./gradlew check publish --no-daemon
29
+ run : ./gradlew check publish -Psnapshot - -no-daemon
30
30
env :
31
31
GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
32
32
GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ or [JVM](https://github.com/Eppo-exp/java-server-sdk) SDKs.
10
10
11
11
``` groovy
12
12
dependencies {
13
- implementation 'cloud.eppo:sdk-common-jvm:1 .0.0'
13
+ implementation 'cloud.eppo:sdk-common-jvm:2 .0.0'
14
14
}
15
15
```
16
16
@@ -49,6 +49,6 @@ repositories {
49
49
}
50
50
51
51
dependencies {
52
- implementation 'cloud.eppo:sdk-common-jvm:1.0 .0-SNAPSHOT'
52
+ implementation 'cloud.eppo:sdk-common-jvm:2.1 .0-SNAPSHOT'
53
53
}
54
54
```
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ plugins {
6
6
}
7
7
8
8
group = ' cloud.eppo'
9
- version = ' 2.0.0-SNAPSHOT '
9
+ version = ' 2.0.0'
10
10
ext. isReleaseVersion = ! version. endsWith(" SNAPSHOT" )
11
11
12
12
dependencies {
@@ -100,6 +100,35 @@ publishing {
100
100
}
101
101
}
102
102
103
+ // Custom task to ensure we can conditionally publish either a release or snapshot artifact
104
+ // based on a command line switch. See github workflow files for more details on usage.
105
+ task checkVersion {
106
+ doLast {
107
+ if (! project. hasProperty(' release' ) && ! project. hasProperty(' snapshot' )) {
108
+ throw new GradleException (" You must specify either -Prelease or -Psnapshot" )
109
+ }
110
+ if (project. hasProperty(' release' ) && project. version. endsWith(' SNAPSHOT' )) {
111
+ throw new GradleException (" You cannot specify -Prelease with a SNAPSHOT version" )
112
+ }
113
+ if (project. hasProperty(' snapshot' ) && ! project. version. endsWith(' SNAPSHOT' )) {
114
+ throw new GradleException (" You cannot specify -Psnapshot with a non-SNAPSHOT version" )
115
+ }
116
+ project. ext. shouldPublish = true
117
+ }
118
+ }
119
+
120
+ // Ensure checkVersion runs before publishing
121
+ tasks. named(' publish' ). configure {
122
+ dependsOn checkVersion
123
+ }
124
+
125
+ // Conditionally enable or disable publishing tasks
126
+ tasks. withType(PublishToMavenRepository ) {
127
+ onlyIf {
128
+ project. ext. has(' shouldPublish' ) && project. ext. shouldPublish
129
+ }
130
+ }
131
+
103
132
signing {
104
133
sign publishing. publications. mavenJava
105
134
if (System . env[' CI' ]) {
You can’t perform that action at this time.
0 commit comments