-
Notifications
You must be signed in to change notification settings - Fork 106
132 lines (129 loc) · 4.87 KB
/
ios_release.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
name: iOS release
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
jobs:
code_quality:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Unit tests
run: ./gradlew testDebugUnitTest
build_and_release:
needs: code_quality
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true
cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
- name: Cache KMP tooling
uses: actions/cache@v4
with:
path: |
~/.konan
key: ${{ runner.os }}-v1-${{ hashFiles('*.versions.toml') }}
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Import certs
uses: apple-actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.IOS_CERTIFICATES_P12 }}
p12-password: ${{ secrets.IOS_CERTIFICATES_PASSWORD }}
- name: Download provisioning profiles
uses: apple-actions/download-provisioning-profiles@v3
with:
bundle-id: ${{ secrets.IOS_BUNDLE_ID }}
issuer-id: ${{ secrets.IOS_APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.IOS_APPSTORE_KEY_ID }}
api-private-key: ${{ secrets.IOS_APPSTORE_PRIVATE_KEY }}
- name: Build archive
run: |
cd iosApp
xcrun xcodebuild \
-scheme "iosApp" \
-configuration "Release" \
-sdk "iphoneos" \
-parallelizeTargets \
-showBuildTimingSummary \
-disableAutomaticPackageResolution \
-derivedDataPath "${RUNNER_TEMP}/Build/DerivedData" \
-archivePath "${RUNNER_TEMP}/Build/Archives/cpuinfo.xcarchive" \
-resultBundlePath "${RUNNER_TEMP}/Build/Artifacts/cpuinfo.xcresult" \
-destination "generic/platform=iOS" \
DEVELOPMENT_TEAM="${{ secrets.IOS_APPSTORE_TEAM_ID }}" \
PRODUCT_BUNDLE_IDENTIFIER="${{ secrets.IOS_BUNDLE_ID }}" \
CODE_SIGN_STYLE="Manual" \
PROVISIONING_PROFILE_SPECIFIER="${{ secrets.IOS_DEV_PROVISIONING_PROFILE_NAME }}" \
archive
- name: "Generate ExportOptions.plist"
run: |
cat <<EOF > ${RUNNER_TEMP}/Build/ExportOptions.plist
<?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>destination</key>
<string>export</string>
<key>method</key>
<string>app-store</string>
<key>signingStyle</key>
<string>manual</string>
<key>generateAppStoreInformation</key>
<true/>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>${{ secrets.IOS_APPSTORE_TEAM_ID }}</string>
<key>uploadSymbols</key>
<true/>
<key>provisioningProfiles</key>
<dict>
<key>${{ secrets.IOS_BUNDLE_ID }}</key>
<string>${{ secrets.IOS_DIST_PROVISIONING_PROFILE_NAME }}</string>
</dict>
</dict>
</plist>
EOF
- id: build_ipa
name: Build IPA
run: |
xcrun xcodebuild \
-exportArchive \
-exportOptionsPlist "${RUNNER_TEMP}/Build/ExportOptions.plist" \
-archivePath "${RUNNER_TEMP}/Build/Archives/cpuinfo.xcarchive" \
-exportPath "${RUNNER_TEMP}/Build/Archives/cpuinfo.xcarchive" \
PRODUCT_BUNDLE_IDENTIFIER="${{ secrets.IOS_BUNDLE_ID }}"
echo "ipa_path=${RUNNER_TEMP}/Build/Archives/cpuinfo.xcarchive/CPU Info.ipa" >> $GITHUB_ENV
- uses: Apple-Actions/upload-testflight-build@v1
with:
app-path: ${{ env.ipa_path }}
issuer-id: ${{ secrets.IOS_APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.IOS_APPSTORE_KEY_ID }}
api-private-key: ${{ secrets.IOS_APPSTORE_PRIVATE_KEY }}
- name: Tag Release
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git tag ${{ github.event.inputs.version }}
git push origin ${{ github.event.inputs.version }}