Skip to content

Commit

Permalink
Update CI (#8)
Browse files Browse the repository at this point in the history
* Update CI

* Update ci.yml

* Add Version model

* Update ASC to 1.0.1

* Formated

* Add sendable

* Add model extensions

* Add updateVersionLocalization

* Add bundleId create

* Add methods

* Update methods and add age ratings

* Add app info

* Add App Category methods

* Move app services

* Add patch methods

* Update app version up

* Update cert saving

* Update keychain

* Add app version create

* Add fetch app

* Add app submit

* Updated CustomerReviewService

* Add СacheService

* Update CI
  • Loading branch information
aromanov91 authored Nov 28, 2024
1 parent 4bdca51 commit c78baa9
Show file tree
Hide file tree
Showing 58 changed files with 3,543 additions and 470 deletions.
42 changes: 25 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,30 @@ concurrency:
cancel-in-progress: true

jobs:
build-swiftpm:
name: Build SwiftPM
uses: oversizedev/GithubWorkflows/.github/workflows/build-swiftpm.yml@main
with:
package: "OversizeAppStoreServices"
secrets: inherit

tests:
name: Test
needs: build-swiftpm
uses: oversizedev/GithubWorkflows/.github/workflows/test.yml@main
secrets: inherit
tests:
name: Tests
if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/')
uses: oversizedev/GithubWorkflows/.github/workflows/test.yml@main
secrets: inherit

build-swiftpm:
name: Build SwiftPM
needs: tests
uses: oversizedev/GithubWorkflows/.github/workflows/build-swiftpm-all-platforms.yml@main
with:
package: OversizeAppStoreServices
secrets: inherit

bump:
name: Bump version
needs: tests
if: github.ref == 'refs/heads/main'
uses: oversizedev/GithubWorkflows/.github/workflows/bump.yml@main
secrets: inherit
bump:
name: Bump version
needs: build-swiftpm
if: github.ref == 'refs/heads/main'
uses: oversizedev/GithubWorkflows/.github/workflows/bump.yml@main
secrets: inherit

release:
name: Create Release
if: github.ref != 'refs/heads/main' && startsWith(github.ref, 'refs/tags/')
uses: oversizedev/GithubWorkflows/.github/workflows/release.yml@main
secrets: inherit
16 changes: 0 additions & 16 deletions .github/workflows/release.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--swiftversion 6.0
--disable preferKeyPath
--ifdef no-indent
25 changes: 15 additions & 10 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
// swift-tools-version: 5.9
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import Foundation
import PackageDescription

let remoteDependencies: [PackageDescription.Package.Dependency] = [
.package(url: "https://github.com/aaronsky/asc-swift.git", .upToNextMajor(from: "0.6.1")),
let commonDependencies: [PackageDescription.Package.Dependency] = [
.package(url: "https://github.com/aaronsky/asc-swift.git", .upToNextMajor(from: "1.0.1")),
.package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3")),
.package(url: "https://github.com/1024jp/GzipSwift", .upToNextMajor(from: "6.1.0")),
.package(url: "https://github.com/dehesa/CodableCSV.git", .upToNextMajor(from: "0.6.7"))
]

let remoteDependencies: [PackageDescription.Package.Dependency] = commonDependencies + [
.package(url: "https://github.com/oversizedev/OversizeCore.git", .upToNextMajor(from: "1.3.0")),
.package(url: "https://github.com/oversizedev/OversizeServices.git", .upToNextMajor(from: "1.4.0")),
.package(url: "https://github.com/oversizedev/OversizeModels.git", .upToNextMajor(from: "0.1.0")),
]

let localDependencies: [PackageDescription.Package.Dependency] = [
.package(url: "https://github.com/aaronsky/asc-swift.git", .upToNextMajor(from: "0.6.1")),
.package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3")),
let localDependencies: [PackageDescription.Package.Dependency] = commonDependencies + [
.package(name: "OversizeCore", path: "../OversizeCore"),
.package(name: "OversizeModels", path: "../OversizeModels"),
.package(name: "OversizeServices", path: "../OversizeServices"),
Expand All @@ -29,10 +32,10 @@ if ProcessInfo.processInfo.environment["BUILD_MODE"] == "PRODUCTION" {
let package = Package(
name: "OversizeAppStoreServices",
platforms: [
.iOS(.v15),
.macOS(.v12),
.tvOS(.v15),
.watchOS(.v8),
.iOS(.v16),
.macOS(.v13),
.tvOS(.v16),
.watchOS(.v9),
],
products: [
.library(
Expand All @@ -50,6 +53,8 @@ let package = Package(
.product(name: "OversizeCore", package: "OversizeCore"),
.product(name: "OversizeModels", package: "OversizeModels"),
.product(name: "OversizeServices", package: "OversizeServices"),
.product(name: "Gzip", package: "GzipSwift"),
.product(name: "CodableCSV", package: "CodableCSV")
]
),
.testTarget(
Expand Down
24 changes: 17 additions & 7 deletions Sources/OversizeAppStoreServices/Auth/EnvAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,37 @@
//

import AppStoreConnect
import Factory
import Foundation
import OversizeServices

public struct EnvAuthenticator: Authenticator {
private let secureStorage: KeychainService = .init()

private let storage: SecureStorageService = .init()
private var jwt: JWT
public var api: API { jwt.api }

public init(
api: API = .appStoreConnect

public init() throws {
) throws {
guard let keyLabel = UserDefaults.standard.string(forKey: "AppStore.Account") else {
throw Error.missingEnvironmentVariable("AppStore.Account")
}

guard let appStoreCertificate = secureStorage.getAppStoreCertificate(with: keyLabel) else {
guard let appStoreCertificate = storage.getPassword(for: "AppConnector-Certificate-" + keyLabel) else {
throw Error.missingEnvironmentVariable("AppStore.Key.Default")
}

guard let appStoreCredentials = storage.getCredentials(with: "AppConnector-" + keyLabel) else {
throw Error.missingEnvironmentVariable("AppStore.Key.Default")
}

let privateKey = try JWT.PrivateKey(pemRepresentation: appStoreCertificate.privateKey)
let privateKey = try JWT.PrivateKey(pemRepresentation: appStoreCertificate)

jwt = JWT(
keyID: appStoreCertificate.keyId,
issuerID: appStoreCertificate.issuerId,
api: api,
keyID: appStoreCredentials.password,
issuerID: appStoreCredentials.login,
expiryDuration: 20 * 60,
privateKey: privateKey
)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public struct NetworkEnvironment {
public var description: String {
switch self {
case let .unreadableEntry(context):
return """
"""
\(context.url.relativePath):\(context.line): Unreadable entry in "\(context.content)"
"""
}
}

/// Context for the error thrown.
public struct ParseContext: Equatable {
public struct ParseContext: Equatable, Sendable {
/// The content of the line the error occurred at.
public var content: String
/// The line number.
Expand Down Expand Up @@ -72,7 +72,7 @@ public struct NetworkEnvironment {
loadedEnvironment[name] ?? processInfo.environment[name]
}
set {
guard let newValue = newValue else { return }
guard let newValue else { return }
loadedEnvironment[name] = newValue
}
}
Expand Down
Loading

0 comments on commit c78baa9

Please sign in to comment.