Skip to content

Commit 4048b0c

Browse files
authored
chore: Prepare for v2.0.0 release (#18)
* chore: Prepare for v2.0.0 release * update task list
1 parent 8b22e1f commit 4048b0c

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

.github/workflows/publish-sdk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
2626

2727
- name: Publish to Maven Central
28-
run: ./gradlew publish --no-daemon
28+
run: ./gradlew check publish -Prelease --no-daemon
2929
env:
3030
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
3131
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

.github/workflows/publish-snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
2727

2828
- name: Publish Snapshot artifact
29-
run: ./gradlew check publish --no-daemon
29+
run: ./gradlew check publish -Psnapshot --no-daemon
3030
env:
3131
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
3232
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ or [JVM](https://github.com/Eppo-exp/java-server-sdk) SDKs.
1010

1111
```groovy
1212
dependencies {
13-
implementation 'cloud.eppo:sdk-common-jvm:1.0.0'
13+
implementation 'cloud.eppo:sdk-common-jvm:2.0.0'
1414
}
1515
```
1616

@@ -49,6 +49,6 @@ repositories {
4949
}
5050
5151
dependencies {
52-
implementation 'cloud.eppo:sdk-common-jvm:1.0.0-SNAPSHOT'
52+
implementation 'cloud.eppo:sdk-common-jvm:2.1.0-SNAPSHOT'
5353
}
5454
```

build.gradle

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group = 'cloud.eppo'
9-
version = '2.0.0-SNAPSHOT'
9+
version = '2.0.0'
1010
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
1111

1212
dependencies {
@@ -100,6 +100,35 @@ publishing {
100100
}
101101
}
102102

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+
103132
signing {
104133
sign publishing.publications.mavenJava
105134
if (System.env['CI']) {

0 commit comments

Comments
 (0)