-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (138 loc) · 5.58 KB
/
Copy pathtestflight.yml
File metadata and controls
167 lines (138 loc) · 5.58 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: iOS TestFlight
on:
workflow_dispatch:
inputs:
upload_to_app_store_connect:
description: Upload to App Store Connect
required: true
default: "false"
type: choice
options:
- "false"
- "true"
pull_request:
types:
- closed
branches:
- develop
env:
SCHEME: DevLogApp
RUBY_VERSION: "3.2"
XCODE_VERSION: latest
APP_STORE_TEAM_ID: ${{ secrets.APP_STORE_TEAM_ID }}
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
ASC_KEY_PATH: fastlane/AuthKey.p8
SPACESHIP_CONNECT_API_IN_HOUSE: "false"
MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
permissions:
contents: read
jobs:
testflight:
if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && (contains(github.event.pull_request.labels.*.name, 'qa') || contains(github.event.pull_request.labels.*.name, 'qa-local')))
runs-on: macos-latest
timeout-minutes: 45
steps:
- name: Checkout merge commit
if: github.event_name == 'pull_request'
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
- name: Checkout current ref
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v5
- name: Install private config files
uses: ./.github/actions/install-private-config
with:
git_url: ${{ env.MATCH_GIT_URL }}
git_basic_authorization: ${{ env.MATCH_GIT_BASIC_AUTHORIZATION }}
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ env.RUBY_VERSION }}
- name: Select Xcode
shell: bash
run: |
set -euo pipefail
if [ "$XCODE_VERSION" = "latest" ]; then
XCODE_APP="$(find /Applications -maxdepth 1 -name 'Xcode*.app' -type d | sort -V | tail -n 1)"
else
XCODE_APP="/Applications/Xcode_${XCODE_VERSION}.app"
if [ ! -d "$XCODE_APP" ]; then
XCODE_APP="/Applications/Xcode-${XCODE_VERSION}.app"
fi
fi
if [ ! -d "${XCODE_APP:-}" ]; then
echo "Requested Xcode not found for version: $XCODE_VERSION" >&2
exit 1
fi
sudo xcode-select -s "$XCODE_APP/Contents/Developer"
xcodebuild -version
- name: Set up Tuist
uses: jdx/mise-action@v4
with:
install: true
cache: true
- name: Install SwiftLint
env:
HOMEBREW_REQUIRE_TAP_TRUST: "1"
shell: bash
run: |
set -euo pipefail
brew list swiftlint >/dev/null 2>&1 || brew install swiftlint
swiftlint version
- name: Generate Xcode workspace with Tuist
shell: bash
run: |
set -euo pipefail
tuist generate --no-open
- name: Write App Store Connect API key
env:
ASC_KEY_CONTENT: ${{ secrets.ASC_KEY_CONTENT }}
run: |
printf '%s' "$ASC_KEY_CONTENT" | base64 -D > "$ASC_KEY_PATH"
- name: Build for TestFlight
run: bundle exec fastlane testflight_build_only
- name: Upload dSYM to Firebase Crashlytics
shell: bash
run: |
set -euo pipefail
google_service_info_path="Application/DevLogApp/Sources/Resource/GoogleService-Info.plist"
dsym_zip_path="$(find fastlane/testflight_build -maxdepth 1 -name '*.dSYM.zip' -print -quit)"
upload_symbols_path="$(find "$HOME/Library/Developer/Xcode/DerivedData" "$HOME/Library/Developer/Xcode/SourcePackages" "$GITHUB_WORKSPACE" -path '*/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/upload-symbols' -type f -print -quit 2>/dev/null || true)"
if [ ! -f "$google_service_info_path" ]; then
echo "Missing GoogleService-Info.plist at $google_service_info_path" >&2
exit 1
fi
if [ -z "$dsym_zip_path" ]; then
echo "Missing dSYM zip in fastlane/testflight_build" >&2
exit 1
fi
if [ -z "$upload_symbols_path" ]; then
echo "Missing Firebase Crashlytics upload-symbols script" >&2
exit 1
fi
"$upload_symbols_path" -gsp "$google_service_info_path" -p ios "$dsym_zip_path"
- name: Upload TestFlight build log
if: always()
uses: actions/upload-artifact@v6
with:
name: testflight-build-log
path: ~/Library/Logs/gym/*.log
if-no-files-found: ignore
- name: Upload TestFlight dSYM
if: always()
uses: actions/upload-artifact@v6
with:
name: testflight-dsym
path: fastlane/testflight_build/*.dSYM.zip
if-no-files-found: warn
- name: Skip TestFlight Upload
if: (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'qa-local')) || (github.event_name == 'workflow_dispatch' && inputs.upload_to_app_store_connect != 'true')
run: echo "Skipping TestFlight upload"
- name: Upload to TestFlight
if: (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'qa') && !contains(github.event.pull_request.labels.*.name, 'qa-local')) || (github.event_name == 'workflow_dispatch' && inputs.upload_to_app_store_connect == 'true')
run: bundle exec fastlane upload_testflight_build