feat: add release notes to version file

This commit is contained in:
James Houlahan
2020-12-15 16:28:15 +01:00
parent dfbf25a9f4
commit 4514d72d70
8 changed files with 74 additions and 64 deletions

View File

@ -119,8 +119,8 @@ func (f *FrontendQt) Loop() (err error) {
func (f *FrontendQt) NotifyManualUpdate(update updater.VersionInfo, canInstall bool) {
f.Qml.SetUpdateVersion(update.Version.String())
f.Qml.SetUpdateLandingPage(update.Landing)
f.Qml.SetUpdateReleaseNotesLink("https://protonmail.com/download/ie/release_notes.html")
f.Qml.SetUpdateLandingPage(update.LandingPage)
f.Qml.SetUpdateReleaseNotesLink(update.ReleaseNotesPage)
f.Qml.SetUpdateCanInstall(canInstall)
f.updateInfo = update
f.Qml.NotifyManualUpdate()

View File

@ -180,8 +180,6 @@ func (s *GoQMLInterface) SetFrontend(f *FrontendQt) {
s.SetProgramTitle(f.programName)
s.ConnectOpenLicenseFile(f.openLicenseFile)
s.SetUpdateReleaseNotesLink("https://protonmail.com/download/ie/release_notes.html")
s.ConnectGetLocalVersionInfo(f.getLocalVersionInfo)
s.ConnectCheckForUpdates(f.checkForUpdates)
s.ConnectGetBackendVersion(func() string {

View File

@ -164,8 +164,8 @@ func (s *FrontendQt) Loop() (err error) {
func (s *FrontendQt) NotifyManualUpdate(update updater.VersionInfo, canInstall bool) {
s.Qml.SetUpdateVersion(update.Version.String())
s.Qml.SetUpdateLandingPage(update.Landing)
s.Qml.SetUpdateReleaseNotesLink("https://protonmail.com/download/bridge/release_notes.html")
s.Qml.SetUpdateLandingPage(update.LandingPage)
s.Qml.SetUpdateReleaseNotesLink(update.ReleaseNotesPage)
s.Qml.SetUpdateCanInstall(canInstall)
s.updateInfo = update
s.Qml.NotifyManualUpdate()

View File

@ -118,7 +118,7 @@ func (u *Updater) IsUpdateApplicable(version VersionInfo) bool {
return false
}
if u.settings.GetFloat64(settings.RolloutKey) > version.Rollout {
if u.settings.GetFloat64(settings.RolloutKey) > version.RolloutProportion {
return false
}

View File

@ -49,7 +49,7 @@ func TestCheck(t *testing.T) {
Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.4.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0,
RolloutProportion: 1.0,
},
}
@ -80,13 +80,13 @@ func TestCheckEarlyAccess(t *testing.T) {
Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.0.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0,
RolloutProportion: 1.0,
},
"beta": VersionInfo{
Version: semver.MustParse("1.6.0"),
MinAuto: semver.MustParse("1.0.0"),
Package: "https://protonmail.com/download/bridge/update_1.6.0_linux.tgz",
Rollout: 1.0,
RolloutProportion: 1.0,
},
}
@ -137,7 +137,7 @@ func TestIsUpdateApplicable(t *testing.T) {
Version: semver.MustParse("1.3.0"),
MinAuto: semver.MustParse("1.3.0"),
Package: "https://protonmail.com/download/bridge/update_1.3.0_linux.tgz",
Rollout: 1.0,
RolloutProportion: 1.0,
}
assert.Equal(t, false, updater.IsUpdateApplicable(versionOld))
@ -146,7 +146,7 @@ func TestIsUpdateApplicable(t *testing.T) {
Version: semver.MustParse("1.4.0"),
MinAuto: semver.MustParse("1.3.0"),
Package: "https://protonmail.com/download/bridge/update_1.4.0_linux.tgz",
Rollout: 1.0,
RolloutProportion: 1.0,
}
assert.Equal(t, false, updater.IsUpdateApplicable(versionEqual))
@ -155,7 +155,7 @@ func TestIsUpdateApplicable(t *testing.T) {
Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.3.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0,
RolloutProportion: 1.0,
}
assert.Equal(t, true, updater.IsUpdateApplicable(versionNew))
@ -173,7 +173,7 @@ func TestCanInstall(t *testing.T) {
Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.5.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0,
RolloutProportion: 1.0,
}
assert.Equal(t, false, updater.CanInstall(versionManual))
@ -182,7 +182,7 @@ func TestCanInstall(t *testing.T) {
Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.3.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0,
RolloutProportion: 1.0,
}
assert.Equal(t, true, updater.CanInstall(versionAuto))
@ -200,7 +200,7 @@ func TestInstallUpdate(t *testing.T) {
Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.4.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0,
RolloutProportion: 1.0,
}
client.EXPECT().DownloadAndVerify(
@ -228,7 +228,7 @@ func TestInstallUpdateBadSignature(t *testing.T) {
Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.4.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0,
RolloutProportion: 1.0,
}
client.EXPECT().DownloadAndVerify(
@ -258,7 +258,7 @@ func TestInstallUpdateAlreadyOngoing(t *testing.T) {
Version: semver.MustParse("1.5.0"),
MinAuto: semver.MustParse("1.4.0"),
Package: "https://protonmail.com/download/bridge/update_1.5.0_linux.tgz",
Rollout: 1.0,
RolloutProportion: 1.0,
}
client.EXPECT().DownloadAndVerify(

View File

@ -38,11 +38,14 @@ type VersionInfo struct {
// Installers are the locations of installer files (for manual installation).
Installers []string
// Landing is the address of the app landing page on protonmail.com.
Landing string
// LandingPage is the address of the app landing page on protonmail.com.
LandingPage string
// Rollout is the current progress of the rollout of this release.
Rollout float64
// ReleaseNotesPage is the address of the page containing the release notes.
ReleaseNotesPage string
// RolloutProportion indicates the proportion (0,1] of users that should update to this version.
RolloutProportion float64
}
// VersionMap represents the structure of the version.json file.
@ -56,8 +59,9 @@ type VersionInfo struct {
// "https://protonmail.com/.../something.rpm",
// "https://protonmail.com/.../PKGBUILD"
// ],
// "Landing "https://protonmail.com/bridge",
// "Rollout": 0.5
// "LandingPage": "https://protonmail.com/bridge",
// "ReleaseNotesPage": "https://protonmail.com/.../release_notes.html",
// "RolloutProportion": 0.5
// },
// "beta": {
// "Version": "2.4.0-beta",
@ -67,8 +71,9 @@ type VersionInfo struct {
// "https://protonmail.com/.../something.rpm",
// "https://protonmail.com/.../PKGBUILD"
// ],
// "Landing "https://protonmail.com/bridge",
// "Rollout": 0.5
// "LandingPage": "https://protonmail.com/bridge",
// "ReleaseNotesPage": "https://protonmail.com/.../release_notes.html",
// "RolloutProportion": 0.5
// },
// "...": {
// ...

View File

@ -6,7 +6,6 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
### Added
* GODT-906 Handle RFC2047-encoded content transfer encoding values.
* GODT-875 Added GUI dialog on force update.
* GODT-820 Added GUI notification on impossibility of update installation (both silent and manual).
* GODT-870 Added GUI notification on error during silent update.

View File

@ -88,9 +88,13 @@ func createApp() *cli.App { // nolint[funlen]
Usage: "An installer that can be used to manually install the app (can be specified multiple times)",
},
&cli.StringFlag{
Name: "landing",
Name: "landing-page",
Usage: "The landing page",
},
&cli.StringFlag{
Name: "release-notes-page",
Usage: "The release notes page",
},
&cli.Float64Flag{
Name: "rollout",
Usage: "What proportion of users should receive this update",
@ -129,12 +133,16 @@ func update(c *cli.Context) error {
version.Installers = c.StringSlice("installer")
}
if c.IsSet("landing") {
version.Landing = c.String("landing")
if c.IsSet("landing-page") {
version.LandingPage = c.String("landing-page")
}
if c.IsSet("release-notes-page") {
version.ReleaseNotesPage = c.String("release-notes-page")
}
if c.IsSet("rollout") {
version.Rollout = c.Float64("rollout")
version.RolloutProportion = c.Float64("rollout")
}
if c.IsSet("commit") {