-
Notifications
You must be signed in to change notification settings - Fork 2
214 lines (186 loc) · 8.31 KB
/
app_stg.yaml
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
name: Generate Test Flutter STG
on:
workflow_dispatch:
inputs:
ref:
default: main
description: 'Git Tag, Branch or SHA to build'
required: true
secrets:
BUILD_USER_PAT:
required: true
pull_request:
types:
- closed
branches:
- main
secrets:
BUILD_USER_PAT:
required: true
jobs:
build-android:
name: Generate Play Store STG
permissions:
actions: write
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/setup-java@v1
with:
java-version: 17.0.6
- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v2
with:
channel: stable
version: 3.19.5
- name: 'Checkout ${{ inputs.ref }}'
uses: actions/checkout@v2
with:
path: source
ref: '${{ inputs.ref }}'
- name: Install Google API python client
run: |
pip install google-api-python-client
- name: Get new version code
run: |
echo $GOOGLE_PLAY_SERVICE_ACCOUNT > $RUNNER_TEMP/.service_account
python3 build-utils/get_version_code.py $RUNNER_TEMP/.service_account com.namiml.testflutter.stg internal --quiet >> $RUNNER_TEMP/.new_version_code
rm -f .service_account
env:
GOOGLE_PLAY_SERVICE_ACCOUNT: '${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT }}'
working-directory: source
- name: Create the Keystore
run: |
# import keystore from secrets
echo $KEYSTORE_BASE64 | base64 -d > $RUNNER_TEMP/my_production.keystore
env:
KEYSTORE_BASE64: '${{ secrets.KEY_STORE_BASE64 }}'
- name: Get dependencies
run: |
flutter pub get
working-directory: source/sdk/example/testnami
- name: Build Android App Bundle
run: |
export BUILD_NUMBER_STG=`cat $RUNNER_TEMP/.new_version_code`
flutter build appbundle -t lib/main_staging.dart --flavor stg --release --build-name 1.0.0 --build-number $BUILD_NUMBER_STG
working-directory: source/sdk/example/testnami
- name: Sign Android App Bundle
run: |
jarsigner -keystore $RUNNER_TEMP/my_production.keystore -storepass '${{ secrets.KEY_STORE_PASSWORD }}' -keypass '${{ secrets.KEY_PASSWORD }}' -sigalg SHA256withRSA -digestalg SHA-256 -signedjar build/app/outputs/bundle/stgRelease/app-stg-release-signed.aab build/app/outputs/bundle/stgRelease/app-stg-release.aab '${{ secrets.KEY_ALIAS }}'
working-directory: source/sdk/example/testnami
- name: Uploading to test track
uses: r0adkll/[email protected]
with:
packageName: 'com.namiml.testflutter.stg'
releaseFiles: source/sdk/example/testnami/build/app/outputs/bundle/stgRelease/app-stg-release-signed.aab
serviceAccountJsonPlainText: '${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT }}'
status: completed
track: internal
build-ios:
name: Generate Apple STG
permissions:
actions: write
contents: write
id-token: write
runs-on: macos-14
steps:
- uses: actions/setup-java@v1
with:
java-version: 17.0.6
- name: Set Xcode Version
run: |
sudo xcode-select -switch /Applications/Xcode_15.4.app
- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v2
with:
channel: stable
version: 3.19.5
- name: 'Checkout ${{ inputs.ref }}'
uses: actions/checkout@v2
with:
path: source
ref: '${{ inputs.ref }}'
- name: Checkout appstoreconnect-build-tools
uses: actions/checkout@v2
with:
path: appstoreconnect-build-tools
ref: main
repository: namiml/appstoreconnect-build-tools
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Get expected build number
run: |
pip3 install requests
pip3 install pydantic==1.10.11
pip3 install cryptography
pip3 install PyJWT
echo "1.0.0" > $RUNNER_TEMP/.current_version
export CURRENT_VERSION=`cat $RUNNER_TEMP/.current_version`
python3 get_next_build.py com.namiml.stg.testflutter --prerelease --version=$CURRENT_VERSION > $RUNNER_TEMP/.next_build_number
working-directory: appstoreconnect-build-tools
env:
APPSTORE_API_KEY_ID: '${{ secrets.APPSTORE_API_KEY_ID }}'
APPSTORE_API_PRIVATE_KEY: '${{ secrets.APPSTORE_API_PRIVATE_KEY }}'
APPSTORE_ISSUER_ID: '${{ secrets.APPSTORE_ISSUER_ID }}'
- name: Install Apple Certificate
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: '${{ secrets.IOS_P12_BASE64 }}'
p12-password: '${{ secrets.IOS_CERTIFICATE_PASSWORD }}'
- name: Install the provisioning profile
run: |
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
echo -n "$PROVISIONING_CERTIFICATE_BASE64" | base64 --decode --output $PP_PATH
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
env:
PROVISIONING_CERTIFICATE_BASE64: '${{ secrets.IOS_MOBILE_PROVISION_BASE64_TEST_FLUTTER_STG }}'
- name: Get dependencies
run: |
flutter pub get
working-directory: source/sdk/example/testnami
- name: Store App Store Private Key
run: |
mkdir ~/.private_keys
echo '${{ secrets.APPSTORE_API_PRIVATE_KEY }}' > ~/.private_keys/AuthKey_'${{ secrets.APPSTORE_API_KEY_ID }}'.p8
- name: Update ExportOptions.plist
run: |
sed -i '' -e "s/APPSTORE_TEAM_ID/${{ secrets.APPSTORE_TEAM_ID }}/" ExportOptions.plist
sed -i '' -e "s/APPSTORE_PROVISIONING_PROFILE_UUID/${{ secrets.APPSTORE_PROV_PROFILE_UUID_TEST_FLUTTER_STG }}/g" ExportOptions.plist
working-directory: source/sdk/example/testnami/ios
- name: Adjust version & build number
working-directory: source/sdk/example/testnami
run: |-
export CURRENT_VERSION=`cat $RUNNER_TEMP/.current_version`
export BUILD_NUMBER=`cat $RUNNER_TEMP/.next_build_number`
sed -i '' -e "s/CURRENT_PROJECT_VERSION = 1/CURRENT_PROJECT_VERSION = $BUILD_NUMBER/" ios/Runner.xcodeproj/project.pbxproj
sed -i '' -e "s/MARKETING_VERSION = 1.0/MARKETING_VERSION = $CURRENT_VERSION/" ios/Runner.xcodeproj/project.pbxproj
- name: Build iOS
run: |
export CURRENT_VERSION=`cat $RUNNER_TEMP/.current_version`
export BUILD_NUMBER=`cat $RUNNER_TEMP/.next_build_number`
sed -i '' -e "s/1.0.0+1/$CURRENT_VERSION+$BUILD_NUMBER/" pubspec.yaml
flutter build ios --release --no-codesign --flavor stg -t lib/main_staging.dart --build-name $CURRENT_VERSION --build-number $BUILD_NUMBER
working-directory: source/sdk/example/testnami
- name: Build resolve Swift dependencies
run: |
xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme stg -configuration Release-stg
working-directory: source/sdk/example/testnami
- name: Build xArchive
run: |
xcodebuild -workspace ios/Runner.xcworkspace -scheme stg -configuration Release-stg DEVELOPMENT_TEAM='${{ secrets.APPSTORE_TEAM_ID }}' -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath build-output/app-stg.xcarchive PROVISIONING_PROFILE='${{ secrets.APPSTORE_PROV_PROFILE_UUID_TEST_FLUTTER_STG }}' clean archive CODE_SIGN_IDENTITY='${{ secrets.CODE_SIGNING_IDENTITY }}'
working-directory: source/sdk/example/testnami
- name: Export IPA
run: |
xcodebuild -exportArchive -archivePath build-output/app-stg.xcarchive -exportPath build-output/ios-stg -exportOptionsPlist ios/ExportOptions.plist
working-directory: source/sdk/example/testnami
- name: Upload app to TestFlight
run: |
xcrun altool --upload-app --type ios --file build-output/ios-stg/example.ipa --apiKey $APPSTORE_API_KEY_ID --apiIssuer $APPSTORE_ISSUER_ID
working-directory: source/sdk/example/testnami
env:
APPSTORE_API_KEY_ID: '${{ secrets.APPSTORE_API_KEY_ID }}'
APPSTORE_ISSUER_ID: '${{ secrets.APPSTORE_ISSUER_ID }}'