-
-
Notifications
You must be signed in to change notification settings - Fork 35
218 lines (215 loc) · 9.85 KB
/
publish-app.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
name: Publish APP
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: publish-app
cancel-in-progress: true
jobs:
build-android:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./chameleonultragui
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
- name: Load Secret
uses: mobiledevops/secret-to-file-action@v1
with:
base64-encoded-secret: ${{ secrets.KEY_PROPERTIES }}
filename: "key.properties"
working-directory: "./chameleonultragui/android"
- name: Load Secret
uses: mobiledevops/secret-to-file-action@v1
with:
base64-encoded-secret: ${{ secrets.UPLOAD_KEYSTORE }}
filename: "upload-keystore.jks"
working-directory: "./chameleonultragui"
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: flutter pub get
- run: flutter build appbundle --build-number ${{ github.run_number }}
- uses: actions/upload-artifact@v3
with:
name: appbundle
path: chameleonultragui/build/app/outputs/bundle/release/app-release.aab
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
- name: Install dependencies
run: bundle install
working-directory: "./chameleonultragui/"
- name: Load Secret
uses: mobiledevops/secret-to-file-action@v1
with:
base64-encoded-secret: ${{ secrets.PLAYSTORE_KEY }}
filename: "api-key.json"
working-directory: "./chameleonultragui"
- name: Fastlane Publishing on ${{ github.event.inputs.publish_track }}
if: github.event_name == 'workflow_dispatch' && github.event.inputs.publish_track != ''
run: fastlane ${{ github.event.inputs.publish_track }}
working-directory: "./chameleonultragui/"
- name: Fastlane Publishing on production
if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish_track == ''
run: fastlane production
working-directory: "./chameleonultragui/"
build-macos:
runs-on: macos-latest
env:
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY_IDENTIFIER: ${{ secrets.APP_STORE_CONNECT_KEY_IDENTIFIER }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Fix permissions
run: sudo chown -R $USER . && sudo chmod -R a+rwx .
- name: Enable macOS
run: flutter config --enable-macos-desktop
- name: Install tools
run: brew install automake libtool create-dmg
- name: Install Codemagic
run: pip3 install codemagic-cli-tools --break-system-packages
- name: Export private key
uses: mobiledevops/secret-to-file-action@v1
with:
base64-encoded-secret: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }}
filename: "AuthKey.p8"
working-directory: "./chameleonultragui"
- name: Export certificate
uses: mobiledevops/secret-to-file-action@v1
with:
base64-encoded-secret: ${{ secrets.APP_STORE_CERTIFICATE }}
filename: "cert_key"
working-directory: "./chameleonultragui"
- name: Initialize keychain and certificates
working-directory: "./chameleonultragui"
run: |
export APP_STORE_CONNECT_PRIVATE_KEY=`cat AuthKey.p8`
app-store-connect fetch-signing-files run.chameleon.gui --platform MAC_OS --type MAC_APP_STORE --certificate-key=@file:cert_key --create
app-store-connect certificates list --type MAC_INSTALLER_DISTRIBUTION --certificate-key=@file:cert_key --save 2>&1 | grep -q 'Did not find' && app-store-connect certificates create --type MAC_INSTALLER_DISTRIBUTION --certificate-key=@file:cert_key --save
keychain initialize
keychain add-certificates
xcode-project use-profiles
- name: Build app
working-directory: "./chameleonultragui"
run: |
sudo chown -R $USER . && sudo chmod -R a+rwx .
flutter build macos --release --build-number ${{ github.run_number }} --build-name "1.0.${{ github.run_number }}"
sudo chown -R $USER . && sudo chmod -R a+rwx .
- name: Sign package
working-directory: "./chameleonultragui"
run: |
APP_NAME=$(find $(pwd) -name "*.app")
PACKAGE_NAME=$(basename "$APP_NAME" .app).pkg
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
xcrun productbuild --component "$APP_NAME" /Applications/ unsigned.pkg
INSTALLER_CERT_NAME=$(keychain list-certificates \
| jq '[.[]
| select(.common_name
| contains("Mac Developer Installer"))
| .common_name][0]' \
| xargs)
xcrun productsign --sign "$INSTALLER_CERT_NAME" unsigned.pkg "$PACKAGE_NAME"
sudo chown -R $USER . && sudo chmod -R a+rwx .
- name: Upload package to App Store
working-directory: "./chameleonultragui"
run: |
export APP_STORE_CONNECT_PRIVATE_KEY=`cat AuthKey.p8`
app-store-connect publish --path "$PACKAGE_NAME"
while [[ -z "$BUILD_ID" ]]; do
export BUILD_ID=$(app-store-connect list-builds --build-version-number ${{ github.run_number }} --processing-state VALID | grep -B 7 "Min os version: 10.14" | awk '/^Id:/ {print $2}')
if [[ -z "$BUILD_ID" ]]; then
echo "Build is not ready, retrying in 5 seconds..."
sleep 5
fi
done
echo "BUILD_ID=$BUILD_ID" >> $GITHUB_ENV
- name: Submit to App Store
working-directory: "./chameleonultragui"
run: |
export APP_STORE_CONNECT_PRIVATE_KEY=`cat AuthKey.p8`
app-store-connect builds submit-to-app-store --cancel-previous-submissions --platform=MAC_OS --version-string="1.0.${{ github.run_number }}" --whats-new="Compiled from `git log --pretty=format:%s --oneline --ancestry-path HEAD~1..HEAD`" --version-string="1.0.${{ github.run_number }}" $BUILD_ID
- name: Submit to TestFlight
working-directory: "./chameleonultragui"
run: |
export APP_STORE_CONNECT_PRIVATE_KEY=`cat AuthKey.p8`
app-store-connect builds submit-to-testflight $BUILD_ID || true
app-store-connect beta-groups add-build $BUILD_ID --beta-group="Open beta testing" || true
build-ios:
runs-on: macos-13
env:
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY_IDENTIFIER: ${{ secrets.APP_STORE_CONNECT_KEY_IDENTIFIER }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install tools
run: brew install automake libtool create-dmg
- name: Install Codemagic
run: pip3 install codemagic-cli-tools
- name: Export private key
uses: mobiledevops/secret-to-file-action@v1
with:
base64-encoded-secret: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }}
filename: "AuthKey.p8"
working-directory: "./chameleonultragui"
- name: Export certificate
uses: mobiledevops/secret-to-file-action@v1
with:
base64-encoded-secret: ${{ secrets.APP_STORE_CERTIFICATE }}
filename: "cert_key"
working-directory: "./chameleonultragui"
- name: Initialize keychain and certificates
working-directory: "./chameleonultragui"
run: |
export APP_STORE_CONNECT_PRIVATE_KEY=`cat AuthKey.p8`
app-store-connect fetch-signing-files $(xcode-project detect-bundle-id) --platform IOS --type IOS_APP_STORE --certificate-key=@file:cert_key --create
keychain initialize
keychain add-certificates
xcode-project use-profiles
- name: Build app
working-directory: "./chameleonultragui"
run: |
flutter build ipa --release --export-options-plist=$HOME/export_options.plist --build-number ${{ github.run_number }} --build-name "1.0.${{ github.run_number }}"
- name: Upload app to App Store
working-directory: "./chameleonultragui"
run: |
export APP_STORE_CONNECT_PRIVATE_KEY=`cat AuthKey.p8`
app-store-connect publish --path $(find $(pwd) -name "*.ipa")
while [[ -z "$BUILD_ID" ]]; do
export BUILD_ID=$(app-store-connect list-builds --build-version-number ${{ github.run_number }} --processing-state VALID | grep -B 7 "Min os version: 12.0" | awk '/^Id:/ {print $2}')
if [[ -z "$BUILD_ID" ]]; then
echo "Build is not ready, retrying in 30 seconds..."
sleep 30
fi
done
echo "BUILD_ID=$BUILD_ID" >> $GITHUB_ENV
- name: Submit to App Store
working-directory: "./chameleonultragui"
run: |
export APP_STORE_CONNECT_PRIVATE_KEY=`cat AuthKey.p8`
app-store-connect builds submit-to-app-store --cancel-previous-submissions --platform=IOS --version-string="1.0.${{ github.run_number }}" --whats-new="Compiled from `git log --pretty=format:%s --oneline --ancestry-path HEAD~1..HEAD`" --version-string="1.0.${{ github.run_number }}" $BUILD_ID
- name: Submit to TestFlight
working-directory: "./chameleonultragui"
run: |
export APP_STORE_CONNECT_PRIVATE_KEY=`cat AuthKey.p8`
app-store-connect builds submit-to-testflight $BUILD_ID || true
app-store-connect beta-groups add-build $BUILD_ID --beta-group="Open beta testing" || true