new: add sha256 to github action for ios
This commit is contained in:
@@ -3,24 +3,45 @@
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "Libcore",
|
||||
platforms: [
|
||||
.iOS(.v13) // Minimum platform version
|
||||
],
|
||||
products: [
|
||||
.library(
|
||||
name: "Libcore",
|
||||
targets: ["Libcore"]),
|
||||
],
|
||||
dependencies: [
|
||||
// No dependencies
|
||||
],
|
||||
targets: [
|
||||
.binaryTarget(
|
||||
name: "Libcore",
|
||||
url: "https://github.com/hiddify/hiddify-next-core/releases/download/draft/hiddify-libcore-ios.xcframework.zip",
|
||||
checksum: "70f84a51508898a706e72ab9eda4af8ab72c321bf79284b38313764b8f2091b2"
|
||||
)
|
||||
]
|
||||
)
|
||||
func fetchChecksum(from url: String) throws -> String {
|
||||
guard let checksumURL = URL(string: url) else {
|
||||
throw NSError(domain: "Invalid URL", code: 0, userInfo: nil)
|
||||
}
|
||||
|
||||
let checksumString = try String(contentsOf: checksumURL)
|
||||
return checksumString.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
}
|
||||
|
||||
let version = "draft"
|
||||
let baseURL = "https://github.com/hiddify/hiddify-next-core/releases/download/"
|
||||
let packageURL = "\(baseURL)\(version)/hiddify-libcore-ios.xcframework.zip"
|
||||
let checksumURL = "\(packageURL).sha256"
|
||||
|
||||
do {
|
||||
let package = Package(
|
||||
name: "Libcore",
|
||||
platforms: [
|
||||
.iOS(.v13) // Minimum platform version
|
||||
],
|
||||
products: [
|
||||
.library(
|
||||
name: "Libcore",
|
||||
targets: ["Libcore"]),
|
||||
],
|
||||
dependencies: [
|
||||
// No dependencies
|
||||
],
|
||||
targets: [
|
||||
.binaryTarget(
|
||||
name: "Libcore",
|
||||
url: packageURL,
|
||||
checksum: try fetchChecksum(from: checksumURL)
|
||||
)
|
||||
]
|
||||
)
|
||||
} catch {
|
||||
// Handle URL or checksum fetch errors
|
||||
print("Error: \(error)")
|
||||
// You might want to exit or handle the error in a way suitable for your application
|
||||
// exit(1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user