Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gradle tasks for updating version in readme #82

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ Then add the following dependencies in your app `build.gradle` or `build.gradle.

**Groovy**

<!--
If format of version definition is changed, make sure to update `generateReadme` task
-->
```groovy
def sentinelVersion = "1.4.1"
debugImplementation "com.infinum.sentinel:sentinel:$sentinelVersion"
Expand Down
6 changes: 5 additions & 1 deletion sentinel/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,8 @@ project.gradle.taskGraph.whenReady {
connectedDebugAndroidTest {
ignoreFailures = true
}
}
}

apply from: '../tasks.gradle'
preBuild.dependsOn ':sentinel:generateReadme'

13 changes: 13 additions & 0 deletions tasks.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apply from: '../config.gradle'

private void replaceVersionsInFile(File file) {
def content = file.text
content = content.replaceAll(~/sentinelVersion\s*=\s*".*"/, "sentinelVersion = \"${releaseConfig.version}\"")
KCeh marked this conversation as resolved.
Show resolved Hide resolved
file.setText(content)
}

tasks.register('generateReadme') {
doFirst {
replaceVersionsInFile(new File("${rootDir}/README.md"))
}
}
Loading