Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 20 additions & 36 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,18 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#java
- name: Set java version
run: |
echo "JAVA_HOME=$JAVA_HOME_21_arm64" >> $GITHUB_ENV
- uses: subosito/flutter-action@v2
with:
# This has to be kept in sync with .tool-versions
flutter-version: '3.27.1'
channel: 'stable'
# This action takes 1m30s to finish. Enable cache to make it shorter.
cache: true
- run: echo "$ANDROID_HOME/tools/bin" >> $GITHUB_PATH
- run: make example-flutter-pub-get
- run: make example-flutter-test
- run: make example-flutter-analyze
- run: make example-dart-format
- run: flutter build apk --debug
working-directory: ./example
- run: make example-build-unsigned-android-aab

deploy-docs:
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -127,48 +121,38 @@ jobs:
deploy-android:
runs-on: macos-14
needs: ["test-android"]
# We cannot build in PRs because secrets are not available in PRs.
if: ${{ github.repository == 'authgear/authgear-sdk-flutter' && github.ref == 'refs/heads/main' }}
defaults:
run:
working-directory: "./example"
if: ${{ github.repository == 'authgear/authgear-sdk-flutter' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: ruby/setup-ruby@v1
with:
node-version-file: "./.tool-versions"
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#java
- name: Set java version
run: |
echo "JAVA_HOME=$JAVA_HOME_21_arm64" >> $GITHUB_ENV
- run: npm install -g appcenter-cli
bundler-cache: true
- uses: subosito/flutter-action@v2
with:
# This has to be kept in sync with .tool-versions
flutter-version: '3.27.1'
channel: 'stable'
# This action takes 1m30s to finish. Enable cache to make it shorter.
cache: true
- run: flutter pub get
- run: flutter test
- run: flutter analyze --no-fatal-infos
- run: dart format --set-exit-if-changed lib
- name: Prepare key store
env:
ANDROID_KEY_STORE_BASE64: ${{ secrets.ANDROID_KEY_STORE_BASE64 }}
run: |
KEY_STORE_PATH=./android/app/keystore.jks

echo -n "$ANDROID_KEY_STORE_BASE64" | base64 --decode -o "$KEY_STORE_PATH"
- name: Build .apk
- run: make example-flutter-pub-get
- run: make example-flutter-test
- run: make example-flutter-analyze
- run: make example-dart-format
- name: Build aab
env:
STORE_BASE64: ${{ secrets.ANDROID_KEY_STORE_BASE64 }}
STORE_PASSWORD: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
BUILD_NUMBER=$(date +%s)
flutter build apk --build-number $BUILD_NUMBER -P STORE_PASSWORD="$STORE_PASSWORD" -P KEY_PASSWORD="$KEY_PASSWORD" -P KEY_ALIAS="$KEY_ALIAS"
- name: Distribute to App Center
export STORE_FILE="$RUNNER_TEMP/upload_key.jks"
echo -n "$STORE_BASE64" | base64 --decode -o "$STORE_FILE"
make example-build-android-aab
- name: Upload aab
if: ${{ github.ref == 'refs/heads/main' }}
env:
APPCENTER_ACCESS_TOKEN: ${{ secrets.ANDROID_APPCENTER_ACCESS_TOKEN }}
run: appcenter distribute release --debug --silent --file "./build/app/outputs/flutter-apk/app-release.apk" --group "Collaborators" --app "Oursky/Authgear-Demo-Flutter-Android"
GOOGLE_SERVICE_ACCOUNT_KEY_JSON_BASE64: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY_JSON_BASE64 }}
run: |
export GOOGLE_SERVICE_ACCOUNT_KEY_JSON_FILE="$RUNNER_TEMP/google_service_account_key.json"
echo -n "$GOOGLE_SERVICE_ACCOUNT_KEY_JSON_BASE64" | base64 --decode -o "$GOOGLE_SERVICE_ACCOUNT_KEY_JSON_FILE"
make example-upload-android-aab
24 changes: 21 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,33 @@ example-pod-install:

.PHONY: example-build-unsigned-ios-app
example-build-unsigned-ios-app:
bundle exec fastlane runner_build_ios_app skip_codesigning:1
bundle exec fastlane ios runner_build_ios_app skip_codesigning:1

.PHONY: example-build-ios-app
example-build-ios-app:
bundle exec fastlane runner_build_ios_app FLUTTER_BUILD_NAME:1.0 FLUTTER_BUILD_NUMBER:$(shell date +%s)
bundle exec fastlane ios runner_build_ios_app FLUTTER_BUILD_NAME:1.0 FLUTTER_BUILD_NUMBER:$(shell date +%s)

.PHONY: example-upload-ios-app
example-upload-ios-app:
bundle exec fastlane upload_ios_app ipa:./build/Release/iOS/Runner/Runner.ipa
bundle exec fastlane ios upload_ios_app ipa:./build/Release/iOS/Runner/Runner.ipa

.PHONY: example-build-unsigned-android-aab
example-build-unsigned-android-aab:
cd ./example/android; ./gradlew :app:bundleDebug

.PHONY: example-build-android-aab
example-build-android-aab:
bundle exec fastlane android build_aab \
VERSION_CODE:$(shell date +%s) \
STORE_FILE:$(STORE_FILE) \
STORE_PASSWORD:$(STORE_PASSWORD) \
KEY_ALIAS:$(KEY_ALIAS) \
KEY_PASSWORD:$(KEY_PASSWORD)

.PHONY: example-upload-android-aab
example-upload-android-aab:
bundle exec fastlane android upload_aab \
json_key:$(GOOGLE_SERVICE_ACCOUNT_KEY_JSON_FILE)

.PHONY: sdk-flutter-pub-get
sdk-flutter-pub-get:
Expand Down
5 changes: 1 addition & 4 deletions example/android/.gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
gradle-wrapper.jar
/.gradle
/.gradle/
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

Expand Down
24 changes: 16 additions & 8 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,35 @@ android {
}

defaultConfig {
applicationId = "com.authgear.exampleapp.flutter"
applicationId = "com.authgear.sdk.exampleapp.flutter"
// minSdkVersion flutter.minSdkVersion
// 21 is required to use androidx.security
minSdk = 21
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
if (project.hasProperty("VERSION_CODE")) {
versionCode = Integer.parseInt(project.findProperty("VERSION_CODE"))
} else {
versionCode = flutter.versionCode
}
versionName = flutter.versionName
}

signingConfigs {
release {
storeFile file("keystore.jks")
storePassword project.ext.has("STORE_PASSWORD") ? project.ext["STORE_PASSWORD"] : ""
keyAlias project.ext.has("KEY_ALIAS") ? project.ext["KEY_ALIAS"] : ""
keyPassword project.ext.has("KEY_PASSWORD") ? project.ext["KEY_PASSWORD"] : ""
if (project.hasProperty("STORE_FILE")) {
release {
storeFile file(project.findProperty("STORE_FILE"))
storePassword project.findProperty("STORE_PASSWORD")
keyAlias project.findProperty("KEY_ALIAS")
keyPassword project.findProperty("KEY_PASSWORD")
}
}
}

buildTypes {
release {
signingConfig signingConfigs.release
if (project.hasProperty("STORE_FILE")) {
signingConfig signingConfigs.release
}
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
Expand Down
Binary file added example/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Loading