-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
74 lines (61 loc) · 1.44 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package main
import (
"fmt"
"os"
"github.com/bitrise-tools/xcode-project/pretty"
"github.com/godrei/go-appstoreconnect/appstoreconnect"
)
func main() {
// log.SetEnableDebugLog(true)
// Authentication
issuer := os.Getenv("ISSUER")
kid := os.Getenv("PRIVATE_KEY_ID")
signingKeyPth := os.Getenv("PRIVATE_KEY_PATH")
c, err := appstoreconnect.NewClient(kid, issuer, signingKeyPth)
if err != nil {
panic(err)
}
// Search for app by bundle id
r, _, err := c.TestFlight.Apps(&appstoreconnect.AppsOptions{
BundleIDFilter: "com.bitrise.Bitrise-iTunesConnectBetaTest",
Limit: 1,
})
if err != nil {
panic(err)
}
app := r.Apps[0]
fmt.Println("app:")
fmt.Println(pretty.Object(app))
fmt.Println("---")
// List all builds
opt := &appstoreconnect.BuildsOptions{
AppFilter: app.ID,
Limit: 20,
}
var allBuilds []appstoreconnect.Build
var i int
for {
resp, _, err := c.TestFlight.Builds(opt)
if err != nil {
panic(err)
}
allBuilds = append(allBuilds, resp.Builds...)
fmt.Printf("%d. turn\n", i)
fmt.Println(pretty.Object(resp.Links))
if resp.Links.Next == "" {
break
}
opt.Next = resp.Links.Next
i++
}
build := allBuilds[0]
fmt.Printf("builds: %d\n", len(allBuilds))
fmt.Println(pretty.Object(build))
fmt.Println("---")
// Submit the last build for Beta Review
resp, err := c.TestFlight.BetaAppReviewSubmission(build.ID)
if err != nil {
panic(err)
}
fmt.Println(pretty.Object(resp))
}