Skip to content

Commit

Permalink
[no ci] make sure snapshots remove the -pre suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
sylv256 committed Jul 17, 2024
1 parent 5596536 commit acde904
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@ version = Versions.GLUON_VERSION

// Takes "1.0.0-beta.1" and changes it to "1.0.0-beta.2", unless we are releasing.
// TODO: there is no way to semantically identify if a release is a snapshot or not right now
if (version.contains("beta") && !ENV.MAVEN_URL) {
if (version.contains("-beta.") && !ENV.MAVEN_URL) {
int beta = Integer.parseInt(version.substring(version.indexOf("beta.") + 5))
version = version.replace(version.substring(version.indexOf("beta.")), "beta." + (beta + 1))
}

// Same thing, but with alphas
if (version.contains("alpha") && !ENV.MAVEN_URL) {
if (version.contains("-alpha.") && !ENV.MAVEN_URL) {
int alpha = Integer.parseInt(version.substring(version.indexOf("alpha.") + 6))
version = version.replace(version.substring(version.indexOf("alpha.")), "alpha." + (alpha + 1))
}

// Same thing, but with pre-releases
if (version.contains("pre") && !ENV.MAVEN_URL) {
int pre = Integer.parseInt(version.substring(version.indexOf("pre.") + 4))
version = version.replace(version.substring(version.indexOf("pre.")), "pre." + (pre + 1))
// Takes "1.0.0-pre.1" and changes it to "1.0.0" if we're publishing a snapshot.
if (version.contains("-pre.") && ENV.SNAPSHOT_URL) {
version = version.replace(version.substring(version.indexOf("-pre.")), "")
}

version = version + "+" + Versions.MINECRAFT_VERSION.version() + (System.getenv("SNAPSHOTS_URL") ? "-SNAPSHOT" : "")
Expand Down

0 comments on commit acde904

Please sign in to comment.