forked from 1jehuang/jcode
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (130 loc) · 4.39 KB
/
Copy pathios-testflight.yml
File metadata and controls
149 lines (130 loc) · 4.39 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: iOS TestFlight
env:
JCODE_CI: "1"
on:
workflow_dispatch:
push:
branches: [master]
paths:
- "ios/**"
- ".github/workflows/ios-testflight.yml"
concurrency:
group: ios-testflight-${{ github.ref }}
cancel-in-progress: true
env:
BUNDLE_ID: com.jcode.mobile
SCHEME: JCodeMobile
TEAM_ID: TAS6ARKDN7
jobs:
test:
name: swift test (JCodeKit)
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Swift toolchain info
run: |
sw_vers
xcodebuild -version
swift --version
- name: Run JCodeKit tests on macOS
working-directory: ios
run: swift test
compile-check:
name: xcodebuild (simulator, unsigned)
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install XcodeGen
run: brew install xcodegen
- name: Generate Xcode project
working-directory: ios
run: xcodegen generate
- name: Build app target for iOS simulator (no signing)
working-directory: ios
run: |
set -o pipefail
xcodebuild build \
-project JCodeMobile.xcodeproj \
-scheme "$SCHEME" \
-configuration Debug \
-destination "generic/platform=iOS Simulator" \
CODE_SIGNING_ALLOWED=NO \
| tail -60
build-and-upload:
name: Build, sign, upload to TestFlight
needs: [test, compile-check]
runs-on: macos-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: Install XcodeGen
run: brew install xcodegen
- name: Generate Xcode project
working-directory: ios
run: xcodegen generate
- name: Write App Store Connect API key
env:
APPSTORE_API_KEY_P8: ${{ secrets.APPSTORE_API_KEY_P8 }}
run: |
mkdir -p ~/private_keys
printf '%s' "$APPSTORE_API_KEY_P8" > ~/private_keys/AuthKey_${{ secrets.APPSTORE_API_KEY_ID }}.p8
chmod 600 ~/private_keys/AuthKey_${{ secrets.APPSTORE_API_KEY_ID }}.p8
- name: Archive (unsigned; signing happens at export)
working-directory: ios
run: |
set -o pipefail
# The team has no registered devices, so a development profile can
# never be created at archive time. Archive unsigned; the export
# step signs with cloud-managed Apple Distribution via the ASC key.
xcodebuild archive \
-project JCodeMobile.xcodeproj \
-scheme "$SCHEME" \
-configuration Release \
-destination "generic/platform=iOS" \
-archivePath build/JCodeMobile.xcarchive \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGN_IDENTITY="" \
DEVELOPMENT_TEAM="$TEAM_ID" \
CURRENT_PROJECT_VERSION="${{ github.run_number }}" \
| tail -100
- name: Write export options
working-directory: ios
run: |
cat > ExportOptions.plist <<'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store-connect</string>
<key>destination</key>
<string>upload</string>
<key>teamID</key>
<string>TAS6ARKDN7</string>
<key>signingStyle</key>
<string>automatic</string>
<key>uploadSymbols</key>
<true/>
<key>manageAppVersionAndBuildNumber</key>
<false/>
</dict>
</plist>
EOF
- name: Export and upload to App Store Connect
working-directory: ios
run: |
set -o pipefail
xcodebuild -exportArchive \
-archivePath build/JCodeMobile.xcarchive \
-exportOptionsPlist ExportOptions.plist \
-exportPath build/export \
-allowProvisioningUpdates \
-authenticationKeyPath "$HOME/private_keys/AuthKey_${{ secrets.APPSTORE_API_KEY_ID }}.p8" \
-authenticationKeyID "${{ secrets.APPSTORE_API_KEY_ID }}" \
-authenticationKeyIssuerID "${{ secrets.APPSTORE_ISSUER_ID }}" \
| tail -60
- name: Cleanup API key
if: always()
run: rm -rf ~/private_keys