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

Fix: Define backports for autoupdater #3171

Open
wants to merge 3 commits into
base: beta
Choose a base branch
from

Conversation

CalMWolfs
Copy link
Collaborator

@CalMWolfs CalMWolfs commented Jan 7, 2025

What

As far as i understand it, a backport is defined as a version where the beta version (second number) is 0 and the bugfix version (third number) isnt a 0
so
1.1.0 wouldnt be a backport but is a beta
1.0.1 would be a backport but isnt a beta
1.0.0 wouldnt be a backport or a beta

Changelog Fixes

  • Fixed the autoupdater not working with new backport updates in some situations. - CalMWolfs

@github-actions github-actions bot added the Backend A backend pull request that will be merged soon label Jan 7, 2025
@CalMWolfs CalMWolfs added this to the Version 2.0.0 milestone Jan 7, 2025
@CalMWolfs CalMWolfs added the Soon This Pull Request will be merged within the next couple of betas label Jan 7, 2025
Comment on lines +15 to +19
override fun selectUpdate(updateStream: String, releases: MutableList<GithubRelease>) = when (updateStream) {
"pre" -> findLatestRelease(releases.filter { !it.isDraft && !ModVersion.fromString(it.tagName).isBackport })
"full" -> findLatestRelease(releases.filter { !it.isDraft && !it.isPrerelease })
else -> null
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You could in theory also just override findLatestRelease to order by the modversion:

		override fun findLatestRelease(validReleases: Iterable<GithubRelease>): UpdateData {
			return validReleases.asSequence().mapNotNull { findAsset(it) }.maxBy { ModVersion.fromString(it.tagName) }
		}

Copy link
Contributor

Choose a reason for hiding this comment

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

This would also allow for upgrading to backport releases if no betas have yet been released:

1.0.0 -> 1.0.1 (no 1.1.0 released yet)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Your solution does allow this but it the version comparison that we have it the mod would mean that using this would also try and update users from the stable/backport branch to the betas which is not intended. I guess I can look into our version comparison further but I feel the current solution I have is more than enough and a backport before a beta is rare enough that it is not needed

Copy link
Contributor

Choose a reason for hiding this comment

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

Im not sure how my change would make users upgrade to betas? The default selectUpdate function already filters for github prereleases, so the findLatestRelease function will not get any betas on the full update stream

@CalMWolfs CalMWolfs changed the title Backend: Define backports for autoupdater Fix: Define backports for autoupdater Jan 8, 2025
@github-actions github-actions bot added Bug Fix Bug fixes and removed Backend A backend pull request that will be merged soon labels Jan 8, 2025
Comment on lines +15 to +19
override fun selectUpdate(updateStream: String, releases: MutableList<GithubRelease>) = when (updateStream) {
"pre" -> findLatestRelease(releases.filter { !it.isDraft && !ModVersion.fromString(it.tagName).isBackport })
"full" -> findLatestRelease(releases.filter { !it.isDraft && !it.isPrerelease })
else -> null
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This would also allow for upgrading to backport releases if no betas have yet been released:

1.0.0 -> 1.0.1 (no 1.1.0 released yet)

Copy link
Contributor

@nea89o nea89o left a comment

Choose a reason for hiding this comment

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

Does not currently support upgrading to backports if there have been no betas but there have been backports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fix Bug fixes Soon This Pull Request will be merged within the next couple of betas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants