Vai*_*ath 8 continuous-integration continuous-deployment ios app-store-connect
我正在设置 CI/CD 应用程序部署以将构建上传到 TestFlight/AppStore,因此需要在构建之前检查之前从 App Store Connect 上传的构建的版本
我已经生成了使用 App Store Connect API 进行身份验证所需的 JWT 令牌,并从以下位置获取了应用程序 ID: https: //api.appstoreconnect.apple.com/v1/apps
现在我使用以下方式请求与该应用程序 ID 相关的构建:https://api.appstoreconnect.apple.com/v1/apps/ {id}/builds
这给了我这个响应(响应数据是分页的(偏移/限制)并且不按上传的构建版本排序):-
{
"data": [
{
"type": "preReleaseVersions",
"id": "<resource id>",
"attributes": {
"version": "1.3",
"platform": "IOS"
},
<some additional trees>
},
{
"type": "preReleaseVersions",
"id": "<resource id>",
"attributes": {
"version": "1.4",
"platform": "IOS"
},
<some additional trees>
},
{
"type": "preReleaseVersions",
"id": "<resource id>",
"attributes": {
"version": "1.2",
"platform": "IOS"
},
<some additional trees>
},
<some more data...>
],
"meta": {
"paging": {
"total": 55,
"limit": 50
}
}
}
Run Code Online (Sandbox Code Playgroud)
我正在寻找的是一些查询字符串参数或不同的 API 或方法,我可以从中获取最新的构建版本,而无需递归调用 API 来获取所有上传的版本,然后从数组中查找最大的版本
小智 5
我还没有找到简单的方法,但这是我想到的最好的方法。
https://api.appstoreconnect.apple.com/v1/builds?filter[app]={app_id}&sort=-version&fields[builds]=version&filter[preReleaseVersion.version]={version_num}&limit=1
Run Code Online (Sandbox Code Playgroud)
这将返回类似以下内容:
{
"data": [
{
"type": "builds",
"id": "ef87f7e1-20e0-4128-9c4d-7aadb23b23ed",
"attributes": {
"version": "30"
},
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/ef87f7e1-20e0-4128-9c4d-7aadb23b23ed"
}
}
],
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds?filter%5BpreReleaseVersion.version%5D=1.2.11&limit=1&sort=-version&filter%5Bapp%5D=&fields%5Bbuilds%5D=version",
"next": "https://api.appstoreconnect.apple.com/v1/builds?cursor=AQ.GXQEGw&filter%5BpreReleaseVersion.version%5D=1.2.11&limit=1&sort=-version&filter%5Bapp%5D=&fields%5Bbuilds%5D=version"
},
"meta": {
"paging": {
"total": 29,
"limit": 1
}
}
}
Run Code Online (Sandbox Code Playgroud)
从这里您只需获取“版本”即可。这很令人困惑,但在这种情况下,版本就是内部版本号。
这种方法有一个问题。有时,即使上传了,苹果也不会处理构建。由于某种原因,这些构建不会显示在此请求中。我不明白为什么苹果对此如此固执。我注意到 FastLane 能够获得最新版本,但我还没有对他们的流程进行逆向工程。
您可以通过检查为特定上传的构建来限制搜索preleaseVersion:
params = { 'filter[version]' => short_bundle_version }
GET https://api.appstoreconnect.apple.com/v1/preReleaseVersions
这将返回包含与该版本关联的构建的 url 的元数据。然后您可以提取相关的构建 URL:
json['relationships']['builds']['links']['related']['data'],
然后请求 url 的关联 JSON,其中将包含构建 ID 及其uploadDate.
| 归档时间: |
|
| 查看次数: |
3670 次 |
| 最近记录: |