Ignore unstable(alfa/beta/rc) versions for stable releases
This commit is contained in:
parent
136baacc93
commit
1ba4933545
11 changed files with 47 additions and 19 deletions
2
.github/workflows/ci_release.yml
vendored
2
.github/workflows/ci_release.yml
vendored
|
@ -4,7 +4,7 @@ on:
|
|||
workflow_dispatch:
|
||||
inputs:
|
||||
mode:
|
||||
description: 'Mode: stable, testing'
|
||||
description: 'Mode: stable, testing(alpha, beta, rc)'
|
||||
required: true
|
||||
default: 'testing'
|
||||
tag:
|
||||
|
|
4
.github/workflows/ci_release_clear.yml
vendored
4
.github/workflows/ci_release_clear.yml
vendored
|
@ -4,9 +4,9 @@ on:
|
|||
workflow_dispatch:
|
||||
inputs:
|
||||
mode:
|
||||
description: 'Mode: stable, testing'
|
||||
description: 'Mode: stable, testing(alpha, beta, rc)'
|
||||
required: true
|
||||
default: 'stable'
|
||||
default: 'testing'
|
||||
|
||||
defaults:
|
||||
run:
|
||||
|
|
|
@ -47,17 +47,20 @@ if(BUILD_MODE MATCHES "DEV")
|
|||
set(MUSESCORE_UNSTABLE ON)
|
||||
set(MUSESCORE_VERSION_LABEL "dev")
|
||||
set(MUSESCORE_NAME_VERSION "${MUSESCORE_NAME} ${MUSESCORE_VERSION_MAJOR}")
|
||||
set(MUSESCORE_ALLOW_UPDATE_ON_PRERELEASE OFF)
|
||||
endif()
|
||||
|
||||
if(BUILD_MODE MATCHES "TESTING")
|
||||
set(MUSESCORE_UNSTABLE OFF)
|
||||
set(MUSESCORE_VERSION_LABEL "Testing")
|
||||
set(MUSESCORE_NAME_VERSION "${MUSESCORE_NAME} ${MUSESCORE_VERSION_MAJOR}.${MUSESCORE_VERSION_MINOR} ${MUSESCORE_VERSION_LABEL}")
|
||||
set(MUSESCORE_ALLOW_UPDATE_ON_PRERELEASE ON)
|
||||
endif()
|
||||
|
||||
if(BUILD_MODE MATCHES "RELEASE")
|
||||
set(MUSESCORE_UNSTABLE OFF)
|
||||
set(MUSESCORE_NAME_VERSION "${MUSESCORE_NAME} ${MUSESCORE_VERSION_MAJOR}")
|
||||
set(MUSESCORE_ALLOW_UPDATE_ON_PRERELEASE OFF)
|
||||
endif()
|
||||
|
||||
if (MUSESCORE_UNSTABLE)
|
||||
|
@ -230,6 +233,9 @@ if (MUSESCORE_UNSTABLE)
|
|||
add_definitions(-DMUSESCORE_UNSTABLE)
|
||||
endif()
|
||||
|
||||
if (MUSESCORE_ALLOW_UPDATE_ON_PRERELEASE)
|
||||
add_definitions(-DMUSESCORE_ALLOW_UPDATE_ON_PRERELEASE)
|
||||
endif()
|
||||
|
||||
function(def_opt name val)
|
||||
if (${val})
|
||||
|
|
|
@ -135,6 +135,11 @@ void Version::setSuffix(const String& suffix)
|
|||
m_suffixVersion = versionSuffix.second;
|
||||
}
|
||||
|
||||
bool Version::preRelease() const
|
||||
{
|
||||
return !suffix().isEmpty();
|
||||
}
|
||||
|
||||
mu::String Version::toString()
|
||||
{
|
||||
String res = String(u"%1.%2.%3").arg(m_major, m_minor, m_patch);
|
||||
|
|
|
@ -34,11 +34,13 @@ public:
|
|||
int majorVersion() const;
|
||||
int minorVersion() const;
|
||||
int patchVersion() const;
|
||||
|
||||
String suffix() const;
|
||||
int suffixVersion() const;
|
||||
|
||||
void setSuffix(const String& suffix);
|
||||
|
||||
bool preRelease() const;
|
||||
|
||||
String toString();
|
||||
|
||||
bool operator <(const Version& other) const;
|
||||
|
|
|
@ -28,12 +28,12 @@ bool UpdateConfigurationStub::isAppUpdatable() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool UpdateConfigurationStub::isTestingMode() const
|
||||
bool UpdateConfigurationStub::allowUpdateOnPreRelease() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void UpdateConfigurationStub::setIsTestingMode(bool)
|
||||
void UpdateConfigurationStub::setAllowUpdateOnPreRelease(bool)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ class UpdateConfigurationStub : public IUpdateConfiguration
|
|||
public:
|
||||
bool isAppUpdatable() const override;
|
||||
|
||||
bool isTestingMode() const override;
|
||||
void setIsTestingMode(bool isTesting) override;
|
||||
bool allowUpdateOnPreRelease() const override;
|
||||
void setAllowUpdateOnPreRelease(bool allow) override;
|
||||
|
||||
bool needCheckForUpdate() const override;
|
||||
void setNeedCheckForUpdate(bool needCheck) override;
|
||||
|
|
|
@ -29,7 +29,7 @@ using namespace mu::framework;
|
|||
static const std::string module_name("update");
|
||||
|
||||
static const Settings::Key CHECK_FOR_UPDATE_KEY(module_name, "application/checkForUpdate");
|
||||
static const Settings::Key CHECK_FOR_UPDATE_TESTING_MODE_KEY(module_name, "application/checkForUpdateTestingMode");
|
||||
static const Settings::Key ALLOW_UPDATE_ON_PRERELEASE(module_name, "application/allowUpdateOnPreRelease");
|
||||
static const Settings::Key SKIPPED_VERSION_KEY(module_name, "application/skippedVersion");
|
||||
|
||||
static const std::string PRIVACY_POLICY_URL_PATH("/about/desktop-privacy-policy");
|
||||
|
@ -56,7 +56,13 @@ void UpdateConfiguration::init()
|
|||
{
|
||||
settings()->setDefaultValue(CHECK_FOR_UPDATE_KEY, Val(isAppUpdatable()));
|
||||
|
||||
settings()->setDefaultValue(CHECK_FOR_UPDATE_TESTING_MODE_KEY, Val(false));
|
||||
bool allowUpdateOnPreRelease = false;
|
||||
#ifdef MUSESCORE_ALLOW_UPDATE_ON_PRERELEASE
|
||||
allowUpdateOnPreRelease = true;
|
||||
#else
|
||||
allowUpdateOnPreRelease = false;
|
||||
#endif
|
||||
settings()->setDefaultValue(ALLOW_UPDATE_ON_PRERELEASE, Val(allowUpdateOnPreRelease));
|
||||
}
|
||||
|
||||
bool UpdateConfiguration::isAppUpdatable() const
|
||||
|
@ -64,14 +70,14 @@ bool UpdateConfiguration::isAppUpdatable() const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool UpdateConfiguration::isTestingMode() const
|
||||
bool UpdateConfiguration::allowUpdateOnPreRelease() const
|
||||
{
|
||||
return settings()->value(CHECK_FOR_UPDATE_TESTING_MODE_KEY).toBool();
|
||||
return settings()->value(ALLOW_UPDATE_ON_PRERELEASE).toBool();
|
||||
}
|
||||
|
||||
void UpdateConfiguration::setIsTestingMode(bool isTesting)
|
||||
void UpdateConfiguration::setAllowUpdateOnPreRelease(bool allow)
|
||||
{
|
||||
settings()->setSharedValue(CHECK_FOR_UPDATE_TESTING_MODE_KEY, Val(isTesting));
|
||||
settings()->setSharedValue(ALLOW_UPDATE_ON_PRERELEASE, Val(allow));
|
||||
}
|
||||
|
||||
bool UpdateConfiguration::needCheckForUpdate() const
|
||||
|
@ -96,7 +102,8 @@ void UpdateConfiguration::setSkippedReleaseVersion(const std::string& version) c
|
|||
|
||||
std::string UpdateConfiguration::checkForUpdateUrl() const
|
||||
{
|
||||
return !isTestingMode() ? "https://updates.musescore.org/feed/latest.xml" : "https://updates.musescore.org/feed/latest.test.xml";
|
||||
return !allowUpdateOnPreRelease() ? "https://updates.musescore.org/feed/latest.xml"
|
||||
: "https://updates.musescore.org/feed/latest.test.xml";
|
||||
}
|
||||
|
||||
mu::network::RequestHeaders UpdateConfiguration::checkForUpdateHeaders() const
|
||||
|
|
|
@ -39,8 +39,8 @@ public:
|
|||
|
||||
bool isAppUpdatable() const override;
|
||||
|
||||
bool isTestingMode() const override;
|
||||
void setIsTestingMode(bool isTesting) override;
|
||||
bool allowUpdateOnPreRelease() const override;
|
||||
void setAllowUpdateOnPreRelease(bool allow) override;
|
||||
|
||||
bool needCheckForUpdate() const override;
|
||||
void setNeedCheckForUpdate(bool needCheck) override;
|
||||
|
|
|
@ -84,6 +84,14 @@ mu::RetVal<ReleaseInfo> UpdateService::checkForUpdate()
|
|||
|
||||
Version current(MUVersion::fullVersion());
|
||||
Version update(String::fromStdString(releaseInfo.val.version));
|
||||
|
||||
bool allowUpdateOnPreRelease = configuration()->allowUpdateOnPreRelease();
|
||||
bool isPreRelease = update.preRelease();
|
||||
|
||||
if (!allowUpdateOnPreRelease && isPreRelease) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (update <= current) {
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ public:
|
|||
|
||||
virtual bool isAppUpdatable() const = 0;
|
||||
|
||||
virtual bool isTestingMode() const = 0;
|
||||
virtual void setIsTestingMode(bool isTesting) = 0;
|
||||
virtual bool allowUpdateOnPreRelease() const = 0;
|
||||
virtual void setAllowUpdateOnPreRelease(bool allow) = 0;
|
||||
|
||||
virtual bool needCheckForUpdate() const = 0;
|
||||
virtual void setNeedCheckForUpdate(bool needCheck) = 0;
|
||||
|
|
Loading…
Reference in a new issue