Skip to content

Commit 8526086

Browse files
committed
Updates README.md
1 parent 4341d14 commit 8526086

1 file changed

Lines changed: 70 additions & 3 deletions

File tree

README.md

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,84 @@
1-
[![Build Status][build status badge]][build status]
2-
[![Platforms][platforms badge]][platforms]
3-
41
# XcodeCloudKit
52

63
The Swift SDK that makes working with the Xcode Cloud endpoints from the App Store Connect API a breeze!
74

5+
[![Build Status][build status badge]][build status]
6+
[![Platforms][platforms badge]][platforms]
7+
88
[build status]: https://github.com/runway-org/xcode-cloud-kit/actions
99
[build status badge]: https://github.com/runway-org/xcode-cloud-kit/workflows/CI/badge.svg
1010
[platforms]: https://swiftpackageindex.com/runway-org/xcode-cloud-kit
1111
[platforms badge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fmattmassicotte%2FPackageTemplate%2Fbadge%3Ftype%3Dplatforms
1212

1313
## How to use `XcodeCloudKit`?
1414

15+
`XcodeCloudKit` relies on [Antoine Van Der Lee's appstoreconnect-swift-sdk](https://github.com/AvdLee/appstoreconnect-swift-sdk), which provides a fantastic Swift interface to interact with the App Store Connect API.
16+
17+
The App Store Connect API requires all network requests to be authenticated and, as it does not support OAuth, you must create an API key from the dashboard.
18+
19+
Once you have generated a key, you must initialise the SDK by using its `Factory` enum:
20+
21+
```swift
22+
import XcodeCloudKit
23+
24+
let xcodeCloudKit = try Factory.make(
25+
issuerID: "🙈",
26+
privateKeyID: "🙈",
27+
privateKey: "🙈"
28+
)
29+
```
30+
31+
`XcodeCloudKit`'s structure tries to mirror Xcode Cloud's data structure as closely as possible and has three main entities: **products**, **workflows** and **build**s.
32+
33+
**Product**s are the Xcode Cloud representations of your app and you can request a list of them and select one using the SDK:
34+
35+
```swift
36+
// Get a list of all available products
37+
let allProducts = try await xcodeCloudKit.allProducts()
38+
// Get a product by Xcode Cloud ID
39+
let productById = try await xcodeCloudKit.product(withId: "...")
40+
// By repository name
41+
let product = try await xcodeCloudKit.product(withRepositoryName: "NowPlaying")
42+
```
43+
44+
Once you have a product, you can access one or all of its **workflows**, which are the blueprints of your CI/CD pipelines, directly on the instance:
45+
46+
```swift
47+
// Get a list of all available workflows
48+
let allWorkflows = try await product?.workflows()
49+
// Get a workflow by Xcode Cloud ID
50+
let workflowByID = try await product?.workflow(withId: "...")
51+
// Get a workflow by name
52+
let workflow = try await product?.workflow(withName: "Test Workflow")
53+
```
54+
55+
Once you have a **workflow**, you can access the list of **builds** or workflow runs for a specific workflow:
56+
57+
```swift
58+
// Get a list of all available builds
59+
let allBuilds = try await workflow?.allBuilds()
60+
// Get a build by its number
61+
let build = try await workflow?.build(withNumber: 32)
62+
```
63+
64+
And you can even start a new **build** for a specific workflow at a git reference of your choice:
65+
66+
```swift
67+
try await workflow?.start(atGitReference: .branch(name: "main"))
68+
```
69+
70+
> Note that the SDK's functionalities are limited at the moment and more features will get added in the coming days and months.
71+
72+
## Installation
73+
74+
As it stands, `XcodeCloudKit` can only be installed via SPM as follows:
75+
76+
```swift
77+
dependencies: [
78+
.package(url: "https://github.com/runway-org/xcode-cloud-kit.git", .upToNextMajor(from: "0.1.0"))
79+
]
80+
```
81+
1582
## License
1683

1784
**XcodeCloudKit** is available under the MIT license, and uses source code from open source projects. See the [LICENSE](./LICENSE) file for more info.

0 commit comments

Comments
 (0)