generated from JetBrains/compose-multiplatform-ios-android-template
-
Notifications
You must be signed in to change notification settings - Fork 22
179 lines (149 loc) · 7 KB
/
publish-playstore-appstore.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
name: Publishing app to PlayStore and AppStore
on:
push:
tags:
- 'v*'
jobs:
publish_app:
name: Publishing app
runs-on: macos-latest
permissions:
contents: write
env:
github_token: ${{ secrets.GITHUB_TOKEN }}
API_KEY: ${{ secrets.API_KEY }}
REVENUECAT_API_KEY_ANDROID: ${{ secrets.REVENUECAT_API_KEY_ANDROID }}
REVENUECAT_API_KEY_IOS: ${{ secrets.REVENUECAT_API_KEY_IOS }}
steps:
- uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: zulu
cache: gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Caching/Restoring Swift Package
uses: actions/cache@v3
with:
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
# Android building, signing
- name: Decode Android Keystore
env:
ENCODED_KEYSTORE_FILE_STRING: ${{ secrets.SIGNING_KEY_STORE_FILE_BASE64 }}
ENCODED_KEYSTORE_PROPERTIES_STRING: ${{ secrets.SIGNING_KEY_STORE_PROPERTIES_BASE64 }}
run: |
mkdir -p androidApp/keystore
echo $ENCODED_KEYSTORE_FILE_STRING > keystore-b64.txt
base64 -d -i keystore-b64.txt > androidApp/keystore/keystore.jks
echo $ENCODED_KEYSTORE_PROPERTIES_STRING > keystore-props-b64.txt
base64 -d -i keystore-props-b64.txt > androidApp/keystore/keystore.properties
- name: Build Release apk with Gradle
run: ./gradlew assembleRelease
- name: Get Android App Name With Version semantics
run: |
appName=$(./gradlew -q getAppName)
echo "APP_NAME=${appName}" >> $GITHUB_ENV
echo "APK_PATH=androidApp/build/outputs/apk/release/${appName}.apk" >> $GITHUB_ENV
- name: Rename APK
run: |
mv androidApp/build/outputs/apk/release/androidApp-release.apk ${{ env.APK_PATH }}
- name: Build Release Android app bundle with Gradle
run: ./gradlew bundleRelease
# iOS building, signing
- name: Create directory for App Store Connect private keys
run: mkdir -p ~/private_keys
- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.IOS_APP_DISTRIBUTION_CERT_BASE64 }}
P12_PASSWORD: ${{ secrets.IOS_APP_CERT_PASS }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.IOS_APP_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
APPSTORE_CONNECT_API_KEY_BASE64: ${{ secrets.IOS_APPSTORE_CONNECT_API_KEY_BASE64 }}
APPSTORE_API_KEY_ID: ${{ secrets.IOS_APPSTORE_API_KEY_ID }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate, provisioning profile and apikey from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
echo -n "$APPSTORE_CONNECT_API_KEY_BASE64" | base64 --decode -o ~/private_keys/AuthKey_$APPSTORE_API_KEY_ID.p8
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Build iOSApp archive
run: |
xcodebuild -workspace iosApp/iosApp.xcworkspace \
-scheme iosApp \
-sdk iphoneos \
-archivePath $RUNNER_TEMP/iosApp.xcarchive \
-configuration Release \
-destination generic/platform=iOS \
clean archive
- name: Export iosApp ipa file
env:
EXPORT_OPTIONS_PLIST: ${{ secrets.IOS_EXPORT_OPTIONS_BASE64 }}
run: |
EXPORT_OPTS_PATH=$RUNNER_TEMP/ExportOptions.plist
echo -n "$EXPORT_OPTIONS_PLIST" | base64 --decode -o $EXPORT_OPTS_PATH
xcodebuild -exportArchive -archivePath $RUNNER_TEMP/iosApp.xcarchive -exportOptionsPlist $EXPORT_OPTS_PATH -exportPath $RUNNER_TEMP/build
- name: Upload app files to Artifact
uses: actions/upload-artifact@v3
with:
name: appArtifacts
path: |
${{ env.APK_PATH }}
${{ runner.temp }}/build
retention-days: 7
- name: Publish android app to Play Store (Alpha track)
id: deploy
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
packageName: com.travelapp.findtravelnow
releaseFiles: androidApp/build/outputs/bundle/release/androidApp-release.aab
track: alpha
whatsNewDirectory: distribution/whatsnew
- name: Install iTMSTransporter
run: |
wget https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/resources/download/public/Transporter__OSX/bin/ -O iTMSTransporter.pkg
sudo installer -pkg iTMSTransporter.pkg -target /
- name: Publish iOS app to AppStore
env:
APPSTORE_API_KEY_ID: ${{ secrets.IOS_APPSTORE_API_KEY_ID }}
APPSTORE_API_KEY_ISSUER_ID: ${{ secrets.IOS_APPSTORE_API_KEY_ISSUER_ID }}
run: |
bundleShortVersion=$(plutil -extract CFBundleShortVersionString raw -o - iosApp/iosApp/Info.plist)
bundleVersion=$(plutil -extract CFBundleVersion raw -o - iosApp/iosApp/Info.plist)
xcrun altool --upload-package $RUNNER_TEMP/build/FindTravelNow.ipa -t ios \
--apple-id 6471192930 \
--bundle-id com.measify.findtravelnow \
--bundle-short-version-string ${bundleShortVersion} \
--bundle-version ${bundleVersion} \
--apiKey $APPSTORE_API_KEY_ID \
--apiIssuer $APPSTORE_API_KEY_ISSUER_ID --verbose
- name: Create new release from tag
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: |
androidApp/build/outputs/bundle/release/androidApp-release.aab
${{ env.APK_PATH }}
${{ runner.temp }}/build/FindTravelNow.ipa
body_path: distribution/whatsnew/whatsnew-en-US
token: ${{ env.github_token }}