-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Automatic version bumping #96
Automatic version bumping #96
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hhio618 Thank you, this is really cool to see!
I tried running ./gradlew releasePrepare
, and got "unspecified" as the new versionName
:
Bumping versionName from 1.1.4 to unspecified
Bumping versionCode from 1001004 to 1001005
Would it be possible to set the versionName
as well?
3374122
to
086d404
Compare
Thanks, @nya-elimuai. you need to specify either
I added an exception to prompt for either of these parameters. |
app/build.gradle
Outdated
newVersionName = project.properties["version"] | ||
}else { | ||
print project.properties.containsKey("bumpVersion") | ||
if (project.properties.containsKey("bumpVersion")){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add missing whitespace: ) {
@hhio618 This is really cool! Tested with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hhio618 This is really great! Amazing work 👏🏽
I only have one final adjustment, when running ./gradlew releasePrepare -PbumpType=patch
: Instead of bumping the version before the release, bump it after the release. That way it would work the same as with the webapp release versioning.
Example: If the version looks like this before the release:
versionCode 1001005
versionName '1.1.5-SNAPSHOT'
change it to
versionCode 1001005
versionName '1.1.5'
Then release (commit to Git).
And then (after the release), bump the version for the next iteration:
versionCode 1001006
versionName '1.1.6-SNAPSHOT'
app/build.gradle
Outdated
if (project.properties.containsKey("version")){ | ||
newVersionName = project.properties["version"] | ||
}else { | ||
print project.properties.containsKey("bumpVersion") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include a text that explains the printout (to know where in the code the log output comes from)
app/build.gradle
Outdated
print project.properties.containsKey("bumpVersion") | ||
if (project.properties.containsKey("bumpVersion")){ | ||
newVersionName = project.properties["bumpVersion"] | ||
}else if (project.properties.containsKey("bumpType")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add missing whitespace: } else
app/build.gradle
Outdated
@@ -103,6 +104,8 @@ task releasePrepare(dependsOn: releaseClean) { | |||
break | |||
} | |||
newVersionName = "$major.$minor.$patch" | |||
}else{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add missing whitespace: } else {
32bdd85
to
baceb0e
Compare
@nya-elimuai Thanks for the review! I made the changes you mentioned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @hhio618!
Now ./gradlew releasePrepare -PbumpType=patch
worked perfectly:
Bumping versionName from 1.1.4 to 1.1.5
Bumping versionCode from 1001004 to 1001005
However, ./gradlew releasePerform
failed:
./gradlew releasePerform
Task 'releasePerform' not found in root project 'Vitabu'.
Am I using ./gradlew releasePerform
correctly?
32f7881
to
7d42b5e
Compare
7d42b5e
to
801a406
Compare
@nya-elimuai Fixed, I also updated the |
app/build.gradle
Outdated
} | ||
} | ||
} | ||
task releaseClean(dependsOn: ensureCleanRepo) { | ||
doLast { | ||
def Clean = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make Clean
lower-case: clean
app/build.gradle
Outdated
while (headCommitMessage.contains("[gradle-release-task]")) { | ||
Clean = false | ||
println "Found git commit: $headCommitMessage" | ||
if (headCommitMessage.indexOf("vitabu-") > -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make the solution scalable to other Android apps (with different names, can you change "vitabu-" into a variable? For example by using the applicationId
variable instead?
Would require adjusting the string used in grgit.commit()
: "prepare release ${applicationId}-"
app/build.gradle
Outdated
Clean = false | ||
println "Found git commit: $headCommitMessage" | ||
if (headCommitMessage.indexOf("vitabu-") > -1) { | ||
def tagName = headCommitMessage.split("vitabu-")[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here as above.
app/build.gradle
Outdated
headCommitMessage = grgit.head().shortMessage | ||
|
||
} | ||
if (Clean){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to if (clean) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Only added a suggestion to use the applicationId
variable.
9656e87
to
6bfd05c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thank you!
Description
closes #94
Tasks