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

Copy release notes from previous release also when it's a staged rollout #1105

Merged
merged 1 commit into from
Nov 2, 2023
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ src/main/play/release-notes/en-US/default.txt
When you publish to the beta channel, the `beta.txt` release notes will be uploaded. For any other
channel, `default.txt` will be uploaded.

If no release notes are found, GPP will try to copy release notes from the previous release.

> Note: the Play Store limits your release notes to a maximum of 500 characters.

#### Uploading developer facing release names
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ internal class DefaultTrackManager(
createDefaultTrack(config)
}

track.maybeCopyChangelogFromPreviousRelease(config.trackName)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dumb question cuz I don't remember how anything works, but why was this removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of calling Track.maybeCopyChangelogFromPreviousRelease we now call TrackRelease.maybeCopyChangelogFromPreviousRelease in places where we create a TrackRelease. So this functionality is still there, just in different places.


publisher.updateTrack(editId, track)
}

Expand Down Expand Up @@ -118,8 +116,10 @@ internal class DefaultTrackManager(
}
}
} else {
track.releases = track.releases +
listOf(TrackRelease().mergeChanges(config.versionCodes, config.base))
val release = TrackRelease().mergeChanges(config.versionCodes, config.base).apply {
maybeCopyChangelogFromPreviousRelease(config.trackName)
}
track.releases = track.releases + release
}
}

Expand All @@ -130,24 +130,29 @@ internal class DefaultTrackManager(
val track = publisher.getTrack(editId, config.trackName)

val keep = track.releases.orEmpty().filterNot { it.isRollout() }
track.releases = keep + listOf(TrackRelease().mergeChanges(config.versionCodes, config.base))
val release = TrackRelease().mergeChanges(config.versionCodes, config.base).apply {
maybeCopyChangelogFromPreviousRelease(config.trackName)
}
track.releases = keep + release

return track
}

private fun createDefaultTrack(config: TrackManager.UpdateConfig) = Track().apply {
track = config.trackName
releases = listOf(TrackRelease().mergeChanges(config.versionCodes, config.base))
val release = TrackRelease().mergeChanges(config.versionCodes, config.base).apply {
maybeCopyChangelogFromPreviousRelease(config.trackName)
}
releases = listOf(release)
}

private fun Track.maybeCopyChangelogFromPreviousRelease(trackName: String) {
val release = releases.singleOrNull { track == trackName } ?: return
if (!release.releaseNotes.isNullOrEmpty()) return
private fun TrackRelease.maybeCopyChangelogFromPreviousRelease(trackName: String) {
if (!releaseNotes.isNullOrEmpty()) return

val previousRelease = publisher.getTrack(editId, trackName)
.releases.orEmpty()
.maxByOrNull { it.versionCodes.orEmpty().maxOrNull() ?: 1 }
release.releaseNotes = previousRelease?.releaseNotes
releaseNotes = previousRelease?.releaseNotes
}

private fun TrackRelease.mergeChanges(
Expand Down
Loading