versioning: fix dirty commit notifications (#1084)
This commit is contained in:
@@ -6,13 +6,13 @@
|
|||||||
<div class="card-body" v-if="version">
|
<div class="card-body" v-if="version">
|
||||||
<h2>Version {{version}}</h2>
|
<h2>Version {{version}}</h2>
|
||||||
<br />
|
<br />
|
||||||
<div class="alert alert-success" v-if="version.indexOf('dirty') !== -1">
|
|
||||||
Thank you for helping to make Sunshine a better software! 🌇
|
|
||||||
</div>
|
|
||||||
<div v-if="loading">
|
<div v-if="loading">
|
||||||
Loading Latest Release...
|
Loading Latest Release...
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="!nightlyBuildAvailable && !stableBuildAvailable">
|
<div class="alert alert-success" v-if="runningDirtyBuild">
|
||||||
|
Thank you for helping to make Sunshine a better software! 🌇
|
||||||
|
</div>
|
||||||
|
<div v-else-if="!nightlyBuildAvailable && !stableBuildAvailable && !runningDirtyBuild">
|
||||||
<div class="alert alert-success">
|
<div class="alert alert-success">
|
||||||
You're running the latest version of Sunshine
|
You're running the latest version of Sunshine
|
||||||
</div>
|
</div>
|
||||||
@@ -97,18 +97,19 @@
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
runningDirtyBuild() {
|
||||||
|
return this.buildVersionIsDirty()
|
||||||
|
},
|
||||||
stableBuildAvailable() {
|
stableBuildAvailable() {
|
||||||
// If we can't get versions, return false
|
// If we can't get versions, return false
|
||||||
if (!this.githubVersion || !this.version) return false;
|
if (!this.githubVersion || !this.version) return false;
|
||||||
// If built with dirty git tree, return false
|
|
||||||
if (this.version.indexOf("dirty") !== -1) return false;
|
|
||||||
// Get the GitHub version tag
|
// Get the GitHub version tag
|
||||||
let v = this.githubVersion.name;
|
let v = this.githubVersion.name;
|
||||||
// If the version starts with a v, remove it
|
// If the version starts with a v, remove it
|
||||||
if (v.indexOf("v") === 0) v = v.substring(1);
|
if (v.indexOf("v") === 0) v = v.substring(1);
|
||||||
|
|
||||||
// if nightly, we do an additional check to make sure its an actual upgrade.
|
// if nightly or dirty, we do an additional check to make sure it's an actual upgrade.
|
||||||
if (this.buildVersionIsNightly()) {
|
if (this.buildVersionIsNightly() || this.buildVersionIsDirty()) {
|
||||||
const stableVersion = this.version.split('.').slice(0, 3).join('.');
|
const stableVersion = this.version.split('.').slice(0, 3).join('.');
|
||||||
return this.githubVersion.tag_name.substring(1) > stableVersion;
|
return this.githubVersion.tag_name.substring(1) > stableVersion;
|
||||||
}
|
}
|
||||||
@@ -121,7 +122,7 @@
|
|||||||
// This is important to ensure the UI does not try to load undefined values.
|
// This is important to ensure the UI does not try to load undefined values.
|
||||||
if (!this.nightlyData || this.buildVersionIsStable()) return false;
|
if (!this.nightlyData || this.buildVersionIsStable()) return false;
|
||||||
// If built with dirty git tree, return false
|
// If built with dirty git tree, return false
|
||||||
if (this.version?.indexOf("dirty") !== -1) return false;
|
if (this.buildVersionIsDirty()) return false;
|
||||||
// Get the commit hash
|
// Get the commit hash
|
||||||
let commit = this.version?.split(".").pop();
|
let commit = this.version?.split(".").pop();
|
||||||
// return true if the commit hash is different, otherwise false
|
// return true if the commit hash is different, otherwise false
|
||||||
@@ -129,11 +130,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
buildVersionIsStable() {
|
buildVersionIsDirty() {
|
||||||
return this.version?.split(".").length === 3;
|
return this.version?.split(".").length === 5 &&
|
||||||
|
this.version.indexOf("dirty") !== -1
|
||||||
},
|
},
|
||||||
buildVersionIsNightly() {
|
buildVersionIsNightly() {
|
||||||
return this.version?.split(".").length === 4
|
return this.version?.split(".").length === 4
|
||||||
|
},
|
||||||
|
buildVersionIsStable() {
|
||||||
|
return this.version?.split(".").length === 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user