@@ -40,24 +40,18 @@ jobs:
4040 - uses : ruby/setup-ruby@v1
4141 with :
4242 bundler-cache : true
43- # https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#java
44- - name : Set java version
45- run : |
46- echo "JAVA_HOME=$JAVA_HOME_21_arm64" >> $GITHUB_ENV
4743 - uses : subosito/flutter-action@v2
4844 with :
4945 # This has to be kept in sync with .tool-versions
5046 flutter-version : ' 3.27.1'
5147 channel : ' stable'
5248 # This action takes 1m30s to finish. Enable cache to make it shorter.
5349 cache : true
54- - run : echo "$ANDROID_HOME/tools/bin" >> $GITHUB_PATH
5550 - run : make example-flutter-pub-get
5651 - run : make example-flutter-test
5752 - run : make example-flutter-analyze
5853 - run : make example-dart-format
59- - run : flutter build apk --debug
60- working-directory : ./example
54+ - run : Make example-build-unsigned-android-aab
6155
6256 deploy-docs :
6357 runs-on : ubuntu-24.04
@@ -127,48 +121,38 @@ jobs:
127121 deploy-android :
128122 runs-on : macos-14
129123 needs : ["test-android"]
130- # We cannot build in PRs because secrets are not available in PRs.
131- if : ${{ github.repository == 'authgear/authgear-sdk-flutter' && github.ref == 'refs/heads/main' }}
132- defaults :
133- run :
134- working-directory : " ./example"
124+ if : ${{ github.repository == 'authgear/authgear-sdk-flutter' }}
135125 steps :
136126 - uses : actions/checkout@v4
137- - uses : actions /setup-node@v4
127+ - uses : ruby /setup-ruby@v1
138128 with :
139- node-version-file : " ./.tool-versions"
140- # https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#java
141- - name : Set java version
142- run : |
143- echo "JAVA_HOME=$JAVA_HOME_21_arm64" >> $GITHUB_ENV
144- - run : npm install -g appcenter-cli
129+ bundler-cache : true
145130 - uses : subosito/flutter-action@v2
146131 with :
147132 # This has to be kept in sync with .tool-versions
148133 flutter-version : ' 3.27.1'
149134 channel : ' stable'
150135 # This action takes 1m30s to finish. Enable cache to make it shorter.
151136 cache : true
152- - run : flutter pub get
153- - run : flutter test
154- - run : flutter analyze --no-fatal-infos
155- - run : dart format --set-exit-if-changed lib
156- - name : Prepare key store
157- env :
158- ANDROID_KEY_STORE_BASE64 : ${{ secrets.ANDROID_KEY_STORE_BASE64 }}
159- run : |
160- KEY_STORE_PATH=./android/app/keystore.jks
161-
162- echo -n "$ANDROID_KEY_STORE_BASE64" | base64 --decode -o "$KEY_STORE_PATH"
163- - name : Build .apk
137+ - run : make example-flutter-pub-get
138+ - run : make example-flutter-test
139+ - run : make example-flutter-analyze
140+ - run : make example-dart-format
141+ - name : Build aab
164142 env :
143+ STORE_BASE64 : ${{ secrets.ANDROID_KEY_STORE_BASE64 }}
165144 STORE_PASSWORD : ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
166145 KEY_ALIAS : ${{ secrets.ANDROID_KEY_ALIAS }}
167146 KEY_PASSWORD : ${{ secrets.ANDROID_KEY_PASSWORD }}
168147 run : |
169- BUILD_NUMBER=$(date +%s)
170- flutter build apk --build-number $BUILD_NUMBER -P STORE_PASSWORD="$STORE_PASSWORD" -P KEY_PASSWORD="$KEY_PASSWORD" -P KEY_ALIAS="$KEY_ALIAS"
171- - name : Distribute to App Center
148+ export STORE_FILE="$RUNNER_TEMP/upload_key.jks"
149+ echo -n "$STORE_BASE64" | base64 --decode -o "$STORE_FILE"
150+ make example-build-android-aab
151+ - name : Upload aab
152+ if : ${{ github.ref == 'refs/heads/main' }}
172153 env :
173- APPCENTER_ACCESS_TOKEN : ${{ secrets.ANDROID_APPCENTER_ACCESS_TOKEN }}
174- run : appcenter distribute release --debug --silent --file "./build/app/outputs/flutter-apk/app-release.apk" --group "Collaborators" --app "Oursky/Authgear-Demo-Flutter-Android"
154+ GOOGLE_SERVICE_ACCOUNT_KEY_JSON_BASE64 : ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY_JSON_BASE64 }}
155+ run : |
156+ export GOOGLE_SERVICE_ACCOUNT_KEY_JSON_FILE="$RUNNER_TEMP/google_service_account_key.json"
157+ echo -n "$GOOGLE_SERVICE_ACCOUNT_KEY_JSON_BASE64" | base64 --decode -o "$GOOGLE_SERVICE_ACCOUNT_KEY_JSON_FILE"
158+ make example-upload-android-aab
0 commit comments