-
Notifications
You must be signed in to change notification settings - Fork 0
225 lines (195 loc) · 6.36 KB
/
ios.yml
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: iOS CI/CD Pipeline
on:
push:
branches: [ develop, staging, main ]
pull_request:
branches: [ develop, main ]
# Global environment variables
env:
DEVELOPER_APP_ID: ${{ secrets.DEVELOPER_APP_ID }}
DEVELOPER_APP_IDENTIFIER: ${{ secrets.DEVELOPER_APP_IDENTIFIER }}
PROVISIONING_PROFILE_SPECIFIER: ${{ secrets.PROVISIONING_PROFILE_SPECIFIER }}
TEMP_KEYCHAIN_PASSWORD: ${{ secrets.TEMP_KEYCHAIN_PASSWORD }}
TEMP_KEYCHAIN_USER: ${{ secrets.TEMP_KEYCHAIN_USER }}
APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }}
APPLE_KEY_ISSUER_ID: ${{ secrets.APPLE_KEY_ISSUER_ID }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
BUILD_ENVIRONMENT: ${{ github.ref == 'refs/heads/main' && 'production' || github.ref == 'refs/heads/staging' && 'staging' || 'development' }}
XCODE_VERSION: '15.0'
jobs:
test:
name: Test
runs-on: macos-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Cache Gems
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Cache Pods
uses: actions/cache@v3
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install dependencies
run: |
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
bundle exec pod install
- name: Run tests
run: bundle exec fastlane test
env:
FASTLANE_XCODE_SELECT_TIMEOUT: 60
- name: Upload test results
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: test-results
path: test_output
retention-days: 14
beta:
name: Beta Distribution
needs: test
if: github.ref == 'refs/heads/develop'
runs-on: macos-latest
timeout-minutes: 90
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Install Apple certificates
uses: apple-actions/download-provisioning-profiles@v1
with:
bundle-id: ${{ env.DEVELOPER_APP_IDENTIFIER }}
profile-type: 'IOS_APP_DEVELOPMENT'
issuer-id: ${{ env.APPLE_KEY_ISSUER_ID }}
api-key-id: ${{ env.APPLE_KEY_ID }}
api-private-key: ${{ secrets.APPLE_PRIVATE_KEY }}
- name: Install dependencies
run: |
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
bundle exec pod install
- name: Deploy to Firebase
run: |
bundle exec fastlane beta version:${{ github.sha }}
env:
FIREBASE_CLI_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}
CI_BUILD_NUMBER: ${{ github.run_number }}
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: beta-build
path: builds
retention-days: 14
release:
name: App Store Release
needs: test
if: github.ref == 'refs/heads/main'
runs-on: macos-latest
timeout-minutes: 120
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Install Apple certificates
uses: apple-actions/download-provisioning-profiles@v1
with:
bundle-id: ${{ env.DEVELOPER_APP_IDENTIFIER }}
profile-type: 'IOS_APP_STORE'
issuer-id: ${{ env.APPLE_KEY_ISSUER_ID }}
api-key-id: ${{ env.APPLE_KEY_ID }}
api-private-key: ${{ secrets.APPLE_PRIVATE_KEY }}
- name: Install dependencies
run: |
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
bundle exec pod install
- name: Deploy to App Store
run: |
bundle exec fastlane release version:${{ github.event.release.tag_name }}
env:
APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }}
CI_BUILD_NUMBER: ${{ github.run_number }}
- name: Upload release artifacts
uses: actions/upload-artifact@v3
with:
name: release-build
path: |
builds
builds/signing_identity.log
builds/validation.log
retention-days: 30
- name: Create release notes
if: success()
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.release.tag_name }}
release_name: Release ${{ github.event.release.tag_name }}
body_path: CHANGELOG.md
draft: false
prerelease: false
cleanup:
name: Cleanup
needs: [test, beta, release]
if: always()
runs-on: macos-latest
steps:
- name: Remove temporary keychain
if: always()
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db || true
- name: Clean build artifacts
if: always()
run: |
rm -rf builds/* || true
rm -rf test_output/* || true
rm -rf ~/Library/Developer/Xcode/DerivedData/* || true
- name: Generate cleanup report
if: always()
run: |
echo "Cleanup completed at $(date)" > cleanup_report.txt
echo "Runner: ${{ runner.os }}" >> cleanup_report.txt
echo "Workflow: ${{ github.workflow }}" >> cleanup_report.txt
- name: Upload cleanup report
if: always()
uses: actions/upload-artifact@v3
with:
name: cleanup-report
path: cleanup_report.txt
retention-days: 7