diff --git a/.github/workflows/android-beta.yml b/.github/workflows/android-beta.yml new file mode 100644 index 00000000..960ee0d4 --- /dev/null +++ b/.github/workflows/android-beta.yml @@ -0,0 +1,57 @@ +name: DIDPay Android Beta + +on: + schedule: + - cron: "0 8 * * *" # 8 AM UTC + workflow_dispatch: + +jobs: + android-beta: + name: Android build signed app bundle + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v2 + with: + distribution: "zulu" + java-version: "17" + + - name: Init Hermit + uses: cashapp/activate-hermit@v1 + with: + cache: true + + - name: Install dependencies + run: just get + + - name: Create didpay.keystore and key.properties file + run: | + run: echo "${{ secrets.BETA_ANDROID_KEY_STORE }}" | base64 --decode > android/app/didpay.keystore + echo "storePassword=${{ secrets.BETA_ANDROID_KEYSTORE_PASSWORD }}" >> android/key.properties + echo "keyPassword=${{ secrets.BETA_ANDROID_KEYSTORE_PASSWORD }}" >> android/key.properties + echo "keyAlias=didpay" >> android/key.properties + echo "storeFile=didpay.keystore" >> android/key.properties + + - name: Setup cider for versioning + run: | + flutter pub global activate cider + echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH + + - name: Version the build + id: versioning + run: | + just set-build-number + VERSION_NAME=$(cider version) + echo "Version Name: $VERSION_NAME" + echo "::set-output name=version_name::$VERSION_NAME" + + - name: Build appbundle + run: just build-app-bundle + + - name: Upload build artifact + uses: actions/upload-artifact@v3 + with: + name: android-beta + path: build/app/outputs/bundle/release/app-release.aab diff --git a/Justfile b/Justfile index 8397b9f3..ff60e809 100644 --- a/Justfile +++ b/Justfile @@ -65,3 +65,19 @@ coverage: flutter test --coverage genhtml coverage/lcov.info -o coverage/html open coverage/html/index.html + +# Set build number base on timestamp +set-build-number: + #!/bin/bash + export PATH="$PATH:$HOME/.pub-cache/bin" + if ! command -v cider &> /dev/null + then + flutter pub global activate cider + else + echo "Cider is already installed." + fi + cider bump build --build=$(date '+%s') + +# Build android app bundle +android-app-bundle: + flutter build appbundle diff --git a/android/app/build.gradle b/android/app/build.gradle index fddb6dad..7deb76e0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -12,6 +12,12 @@ if (localPropertiesFile.exists()) { } } +def keyProperties = new Properties() +def keyPropertiesFile = rootProject.file('key.properties') +if (keyPropertiesFile.exists()) { + keyProperties.load(new FileInputStream(keyPropertiesFile)) +} + def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -51,11 +57,18 @@ android { versionName flutterVersionName } + signingConfigs { + release { + keyAlias keyProperties['keyAlias'] + keyPassword keyProperties['keyPassword'] + storeFile file(keyProperties['storeFile']) + storePassword keyProperties['storePassword'] + } + } + buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + signingConfig signingConfigs.release } } } diff --git a/pubspec.lock b/pubspec.lock index aadc0201..1f187092 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: archive - sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" + sha256: "0763b45fa9294197a2885c8567927e2830ade852e5c896fd4ab7e0e348d0f373" url: "https://pub.dev" source: hosted - version: "3.4.10" + version: "3.5.0" args: dependency: transitive description: @@ -313,10 +313,10 @@ packages: dependency: transitive description: name: json_annotation - sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" url: "https://pub.dev" source: hosted - version: "4.8.1" + version: "4.9.0" json_schema: dependency: "direct dev" description: @@ -808,7 +808,7 @@ packages: description: path: "packages/web5" ref: main - resolved-ref: ab92c4bde5662789b4b8c2fa00c5f373c20bfe6f + resolved-ref: "1bc969484bf7613840f921231176adf43a5f0d2c" url: "https://github.com/TBD54566975/web5-dart.git" source: git version: "0.1.0"