Skip to content

Commit

Permalink
Update Gradle Release Tasks for Beta (#89)
Browse files Browse the repository at this point in the history
* Fix README task for beta versions

* Fix SNAPSHOT task
  • Loading branch information
sarahkoop authored Feb 12, 2024
1 parent 0ab5c35 commit 52fcc27
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To preview the latest work in progress builds, add the following SNAPSHOT depend

```groovy
dependencies {
implementation 'com.braintreepayments.api:browser-switch:2.6.2-SNAPSHOT'
implementation 'com.braintreepayments.api:browser-switch:3.0.0-beta1-SNAPSHOT'
}
```

Expand Down
11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,15 @@ task changeGradleReleaseVersion {

task changeREADMEVersion {
doLast {

def readmeFile = new File('README.md')
def readmeFileText = readmeFile.text.replaceFirst(":browser-switch:\\d+\\.\\d+\\.\\d+'", ":browser-switch:" + versionParam + "'")
def readmeFileText = readmeFile.text.replaceFirst(":browser-switch:\\d+\\.\\d+\\.\\d+(-.*)?'", ":browser-switch:" + versionParam + "'")
readmeFile.write(readmeFileText)
}
}

task changeMigrationGuideVersion {
doLast {
def migrationGuideFile = new File('v2_MIGRATION.md')
def migrationGuideFile = new File('v3_MIGRATION.md')
def migrationGuideFileText = migrationGuideFile.text.replaceAll(":\\d+\\.\\d+\\.\\d+(-.*)?'", ":" + versionParam + "'")
migrationGuideFile.write(migrationGuideFileText)
}
Expand All @@ -112,8 +111,10 @@ task incrementSNAPSHOTVersion {
doLast {
def gradleFile = new File('build.gradle')
def (major, minor, patch) = versionParam.tokenize('.')
def patchInteger = patch.toInteger()
def newVersion = "$major.$minor.${patchInteger + 1}-SNAPSHOT"
def patchInteger = patch[-1].toInteger()
patchInteger++
def newPatch = patch.substring(0,patch.length()-1) + patchInteger.toString()
def newVersion = "$major.$minor.$newPatch-SNAPSHOT"
def gradleFileText = gradleFile.text.replaceFirst("\\nversion = '\\d+\\.\\d+\\.\\d+(-.*)?'", "\nversion = '" + newVersion + "'")
gradleFile.write(gradleFileText)

Expand Down

0 comments on commit 52fcc27

Please sign in to comment.