[Beta-Updates]: fix verify step for beta artifact verifications

This commit is contained in:
Magesh K
2024-12-18 02:50:50 +05:30
parent 7af0992a2b
commit 2eeaeca8f4
3 changed files with 10 additions and 5 deletions

View File

@@ -129,9 +129,13 @@ private extension VerifyAppOperation
{
let (version, buildVersion) = await $appVersion.perform { ($0.version, $0.buildVersion) }
let downloadedIpaRevision = Bundle.init(url: app.fileURL)!.object(forInfoDictionaryKey: "BuildRevision") as? String ?? ""
guard version == app.version else { throw VerificationError.mismatchedVersion(app.version, expectedVersion: version, app: app) }
let downloadedIpaRevision = Bundle(url: app.fileURL)!.object(forInfoDictionaryKey: "BuildRevision") as? String ?? ""
let sourceJsonIpaRevision = appVersion.revision
// if not beta but version matches, then accept it, else compare revisions between source and downloaded
if version != app.version || (appVersion.isBeta && downloadedIpaRevision != sourceJsonIpaRevision) {
throw VerificationError.mismatchedVersion(app.version, expectedVersion: version, app: app)
}
if let buildVersion
{

View File

@@ -64,6 +64,7 @@
<attribute name="buildVersion" optional="YES" attributeType="String"/>
<attribute name="date" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="downloadURL" attributeType="URI"/>
<attribute name="isBeta" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="localizedDescription" optional="YES" attributeType="String"/>
<attribute name="maxOSVersion" optional="YES" attributeType="String"/>
<attribute name="minOSVersion" optional="YES" attributeType="String"/>

View File

@@ -98,8 +98,8 @@ public class AppVersion: NSManagedObject, Decodable, Fetchable
self._minOSVersion = try container.decodeIfPresent(String.self, forKey: .minOSVersion)
self._maxOSVersion = try container.decodeIfPresent(String.self, forKey: .maxOSVersion)
// self.isBeta = try container.decodeIfPresent(Bool.self, forKey: .isBeta) ?? false
// self.revision = try container.decodeIfPresent(String.self, forKey: .revision)
self.isBeta = try container.decodeIfPresent(Bool.self, forKey: .isBeta) ?? false
self.revision = try container.decodeIfPresent(String.self, forKey: .revision)
}
catch
{