From 58290d53b3f5cc763bceee72efd54def88180a7f Mon Sep 17 00:00:00 2001 From: jeffallen Date: Wed, 23 Jul 2025 16:09:43 +0000 Subject: [PATCH 1/9] Uncomment Android build job in CI workflow - Remove FIXME comment and activate build-android job - Enable JDK 17 setup, Android SDK, and Gradle configuration - Restore demo-app build and unit test execution steps - Prepare for fixing Android build issues in subsequent commits Co-Authored-By: sketch Change-ID: s496be885aa3c9back --- .github/workflows/ci.yml | 41 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7526973..0cdc2f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,31 +36,30 @@ jobs: cd notification-backend go test -v -run TestEncryption - # FIXME: Android build is broken, commenting out temporarily - # build-android: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v4 + build-android: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 - # - name: Set up JDK 17 - # uses: actions/setup-java@v3 - # with: - # java-version: '17' - # distribution: 'temurin' + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' - # - name: Setup Android SDK - # uses: android-actions/setup-android@v3 + - name: Setup Android SDK + uses: android-actions/setup-android@v3 - # - name: Setup Gradle - # uses: gradle/gradle-build-action@v2 - # with: - # gradle-version: 8.11 + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + with: + gradle-version: 8.11 - # - name: Build demo-app - # run: gradle -p demo-app --no-daemon build - # - # - name: Run Android unit tests - # run: gradle -p demo-app --no-daemon test + - name: Build demo-app + run: gradle -p demo-app --no-daemon build + + - name: Run Android unit tests + run: gradle -p demo-app --no-daemon test go-lint: runs-on: ubuntu-latest From 0293331135bff9de9d51d9f11c5b45d904dbfd09 Mon Sep 17 00:00:00 2001 From: jeffallen Date: Wed, 23 Jul 2025 16:17:12 +0000 Subject: [PATCH 2/9] Update Gradle version to 8.13 for Android build compatibility - Bump gradle-version from 8.11 to 8.13 in CI workflow - Fix compatibility with Android Gradle Plugin 8.11.0 minimum requirements - Resolve build failure: 'Minimum supported Gradle version is 8.13' Co-Authored-By: sketch Change-ID: sb53c1c16819156cfk --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0cdc2f1..0c8a42c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: - name: Setup Gradle uses: gradle/gradle-build-action@v2 with: - gradle-version: 8.11 + gradle-version: 8.13 - name: Build demo-app run: gradle -p demo-app --no-daemon build From 77952663aaff1ffb3559c058ae564c4e1d492a4f Mon Sep 17 00:00:00 2001 From: jeffallen Date: Wed, 23 Jul 2025 16:19:53 +0000 Subject: [PATCH 3/9] Add dummy google-services.json for CI builds - Create mock Firebase configuration file for demo-app - Enable Android build to proceed without real Firebase project - Update .gitignore to allow dummy google-services.json for CI purposes - Contains minimal valid structure matching package name org.nella.fcmapp - Resolves build error: 'File google-services.json is missing' Co-Authored-By: sketch Change-ID: s3d9457fcdf10fd52k --- demo-app/.gitignore | 3 ++- demo-app/app/google-services.json | 39 +++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 demo-app/app/google-services.json diff --git a/demo-app/.gitignore b/demo-app/.gitignore index 4304ddf..9f888ad 100644 --- a/demo-app/.gitignore +++ b/demo-app/.gitignore @@ -1,7 +1,8 @@ .gradle/ .idea/ app/build/ -app/google-services.json +# google-services.json excluded for real Firebase configs, but allow dummy for CI +# app/google-services.json build/ local.properties gradle/ diff --git a/demo-app/app/google-services.json b/demo-app/app/google-services.json new file mode 100644 index 0000000..eee0603 --- /dev/null +++ b/demo-app/app/google-services.json @@ -0,0 +1,39 @@ +{ + "project_info": { + "project_number": "123456789000", + "project_id": "demo-project-id", + "storage_bucket": "demo-project-id.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:123456789000:android:abcdef1234567890", + "android_client_info": { + "package_name": "org.nella.fcmapp" + } + }, + "oauth_client": [ + { + "client_id": "123456789000-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyDemoKeyForCIBuildPurposes123456789" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "123456789000-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file From c9e5ea2f99d5182fdab945f1e7f3ed7b525c31e9 Mon Sep 17 00:00:00 2001 From: jeffallen Date: Wed, 23 Jul 2025 16:21:04 +0000 Subject: [PATCH 4/9] Configure CI to use GitHub secret for google-services.json - Add step to create google-services.json from GOOGLE_SERVICES_JSON secret - Remove dummy google-services.json file from repository - Restore proper .gitignore exclusion for google-services.json - Enable secure Firebase configuration management through GitHub secrets - CI will now dynamically create the file during build process Co-Authored-By: sketch Change-ID: s2a78e59786d788bbk --- .github/workflows/ci.yml | 6 +++++ demo-app/.gitignore | 3 +-- demo-app/app/google-services.json | 39 ------------------------------- 3 files changed, 7 insertions(+), 41 deletions(-) delete mode 100644 demo-app/app/google-services.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c8a42c..7aa6558 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,6 +55,12 @@ jobs: with: gradle-version: 8.13 + - name: Create google-services.json from secret + env: + GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} + run: | + echo "$GOOGLE_SERVICES_JSON" > demo-app/app/google-services.json + - name: Build demo-app run: gradle -p demo-app --no-daemon build diff --git a/demo-app/.gitignore b/demo-app/.gitignore index 9f888ad..4304ddf 100644 --- a/demo-app/.gitignore +++ b/demo-app/.gitignore @@ -1,8 +1,7 @@ .gradle/ .idea/ app/build/ -# google-services.json excluded for real Firebase configs, but allow dummy for CI -# app/google-services.json +app/google-services.json build/ local.properties gradle/ diff --git a/demo-app/app/google-services.json b/demo-app/app/google-services.json deleted file mode 100644 index eee0603..0000000 --- a/demo-app/app/google-services.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "project_info": { - "project_number": "123456789000", - "project_id": "demo-project-id", - "storage_bucket": "demo-project-id.appspot.com" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:abcdef1234567890", - "android_client_info": { - "package_name": "org.nella.fcmapp" - } - }, - "oauth_client": [ - { - "client_id": "123456789000-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyDemoKeyForCIBuildPurposes123456789" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "123456789000-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - } - ], - "configuration_version": "1" -} \ No newline at end of file From 2cb5da3d0dfffa43ebe3ae76bd706382aff20a6d Mon Sep 17 00:00:00 2001 From: jeffallen Date: Wed, 23 Jul 2025 16:38:54 +0000 Subject: [PATCH 5/9] Clarify Firebase client config vs service account distinction - Rename GitHub secret from GOOGLE_SERVICES_JSON to FIREBASE_CLIENT_CONFIG - Update step name to 'Create Firebase client config from secret' - Emphasize this is client configuration for FCM, not service account credentials - Resolve naming confusion between client config and server service accounts Co-Authored-By: sketch Change-ID: s1bc580182499b1e4k --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7aa6558..50624aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,11 +55,11 @@ jobs: with: gradle-version: 8.13 - - name: Create google-services.json from secret + - name: Create Firebase client config from secret env: - GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} + FIREBASE_CLIENT_CONFIG: ${{ secrets.FIREBASE_CLIENT_CONFIG }} run: | - echo "$GOOGLE_SERVICES_JSON" > demo-app/app/google-services.json + echo "$FIREBASE_CLIENT_CONFIG" > demo-app/app/google-services.json - name: Build demo-app run: gradle -p demo-app --no-daemon build From 1e7adb6bd30dd64b44507f1e7840d014baba90a3 Mon Sep 17 00:00:00 2001 From: jeffallen Date: Wed, 23 Jul 2025 17:04:10 +0000 Subject: [PATCH 6/9] Fix Base64 API compatibility for Android minSdk 21 - Replace java.util.Base64 with android.util.Base64 for broader compatibility - Change Base64.getEncoder().encodeToString() to Base64.encodeToString(data, Base64.DEFAULT) - Change Base64.getDecoder().decode() to Base64.decode(data, Base64.DEFAULT) - Maintain support for Android API 21+ without requiring API level 26 - Resolve NewApi lint error for Base64 encoder/decoder methods Co-Authored-By: sketch Change-ID: sbb7337cd4fee1bc4k --- demo-app/app/src/main/java/org/nella/fcmapp/MainActivity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/demo-app/app/src/main/java/org/nella/fcmapp/MainActivity.kt b/demo-app/app/src/main/java/org/nella/fcmapp/MainActivity.kt index 3fcf3b0..a7edf31 100644 --- a/demo-app/app/src/main/java/org/nella/fcmapp/MainActivity.kt +++ b/demo-app/app/src/main/java/org/nella/fcmapp/MainActivity.kt @@ -18,7 +18,7 @@ import java.security.KeyFactory import java.security.PublicKey import java.security.SecureRandom import java.security.spec.X509EncodedKeySpec -import java.util.Base64 +import android.util.Base64 import javax.crypto.Cipher import javax.crypto.KeyGenerator import javax.crypto.SecretKey @@ -213,7 +213,7 @@ class MainActivity : AppCompatActivity() { keyLengthBytes[3] = encryptedAesKey.size.toByte() val combined = iv + keyLengthBytes + encryptedAesKey + encryptedToken - return Base64.getEncoder().encodeToString(combined) + return Base64.encodeToString(combined, Base64.DEFAULT) } private fun loadPublicKey(): PublicKey { @@ -226,7 +226,7 @@ class MainActivity : AppCompatActivity() { .replace("\n", "") .replace("\r", "") - val keyBytes = Base64.getDecoder().decode(publicKeyBase64) + val keyBytes = Base64.decode(publicKeyBase64, Base64.DEFAULT) val keySpec = X509EncodedKeySpec(keyBytes) val keyFactory = KeyFactory.getInstance("RSA") From 782cb53258c5c1144bbb2828a1616e086fa24b73 Mon Sep 17 00:00:00 2001 From: jeffallen Date: Wed, 23 Jul 2025 17:17:42 +0000 Subject: [PATCH 7/9] Update release workflow for Android build compatibility - Bump Gradle version from 8.4 to 8.13 to match Android Gradle Plugin requirements - Add Firebase client config step using FIREBASE_CLIENT_CONFIG secret - Create google-services.json dynamically before APK build process - Apply same fixes from ci.yml to ensure consistent release builds - Enable successful APK generation with proper Firebase configuration Co-Authored-By: sketch Change-ID: s17e5e5d6f9582c23k --- .github/workflows/release.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5724345..8db1b62 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,7 +38,13 @@ jobs: - name: Setup Gradle uses: gradle/gradle-build-action@v2 with: - gradle-version: 8.4 + gradle-version: 8.13 + + - name: Create Firebase client config from secret + env: + FIREBASE_CLIENT_CONFIG: ${{ secrets.FIREBASE_CLIENT_CONFIG }} + run: | + echo "$FIREBASE_CLIENT_CONFIG" > demo-app/app/google-services.json - name: Build Release APK run: | From 2d3a2507e5e66e2b8e03daec88fb9d9d0d05625c Mon Sep 17 00:00:00 2001 From: jeffallen Date: Wed, 23 Jul 2025 17:35:27 +0000 Subject: [PATCH 8/9] Simplify release workflow to Android APK only and fix deprecated actions - Comment out Go binary build jobs (build-go-binaries and upload-go-binaries) - Update actions/upload-artifact from deprecated v3 to v4 - Focus release workflow on Android APK generation only - Resolve GitHub Actions deprecation warning for artifact actions - Streamline release process for faster execution Co-Authored-By: sketch Change-ID: s28fdfbe538db6118k --- .github/workflows/release.yml | 129 +++++++++++++++++----------------- 1 file changed, 65 insertions(+), 64 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8db1b62..cc22009 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -122,72 +122,73 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload APK as artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: android-apk-${{ github.ref_name }} path: demo-app/app/build/outputs/apk/release/${{ env.APK_NAME }} retention-days: 90 - build-go-binaries: - runs-on: ubuntu-latest - strategy: - matrix: - goos: [linux, darwin, windows] - goarch: [amd64, arm64] - exclude: - - goos: windows - goarch: arm64 - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: '1.21' - - - name: Build Go binaries - env: - GOOS: ${{ matrix.goos }} - GOARCH: ${{ matrix.goarch }} - run: | - VERSION=${GITHUB_REF#refs/tags/} - - # Build app-backend - cd app-backend - go build -ldflags "-X main.version=${VERSION}" -o ../bin/app-backend-${GOOS}-${GOARCH}${{ matrix.goos == 'windows' && '.exe' || '' }} . - - # Build notification-backend - cd ../notification-backend - go build -ldflags "-X main.version=${VERSION}" -o ../bin/notification-backend-${GOOS}-${GOARCH}${{ matrix.goos == 'windows' && '.exe' || '' }} . - - - name: Upload Go binaries - uses: actions/upload-artifact@v3 - with: - name: go-binaries-${{ matrix.goos }}-${{ matrix.goarch }} - path: bin/* - retention-days: 90 - - upload-go-binaries: - needs: build-go-binaries - runs-on: ubuntu-latest - steps: - - name: Download all artifacts - uses: actions/download-artifact@v3 - with: - path: artifacts - - - name: Prepare binaries for release - run: | - mkdir -p release-binaries - find artifacts -name "go-binaries-*" -type d | while read dir; do - cp "$dir"/* release-binaries/ 2>/dev/null || true - done - ls -la release-binaries/ - - - name: Upload Go binaries to release - uses: softprops/action-gh-release@v1 - with: - files: release-binaries/* - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Go binary builds commented out - Android APK only for now + # build-go-binaries: + # runs-on: ubuntu-latest + # strategy: + # matrix: + # goos: [linux, darwin, windows] + # goarch: [amd64, arm64] + # exclude: + # - goos: windows + # goarch: arm64 + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 + # + # - name: Set up Go + # uses: actions/setup-go@v4 + # with: + # go-version: '1.21' + # + # - name: Build Go binaries + # env: + # GOOS: ${{ matrix.goos }} + # GOARCH: ${{ matrix.goarch }} + # run: | + # VERSION=${GITHUB_REF#refs/tags/} + # + # # Build app-backend + # cd app-backend + # go build -ldflags "-X main.version=${VERSION}" -o ../bin/app-backend-${GOOS}-${GOARCH}${{ matrix.goos == 'windows' && '.exe' || '' }} . + # + # # Build notification-backend + # cd ../notification-backend + # go build -ldflags "-X main.version=${VERSION}" -o ../bin/notification-backend-${GOOS}-${GOARCH}${{ matrix.goos == 'windows' && '.exe' || '' }} . + # + # - name: Upload Go binaries + # uses: actions/upload-artifact@v3 + # with: + # name: go-binaries-${{ matrix.goos }}-${{ matrix.goarch }} + # path: bin/* + # retention-days: 90 + # + # upload-go-binaries: + # needs: build-go-binaries + # runs-on: ubuntu-latest + # steps: + # - name: Download all artifacts + # uses: actions/download-artifact@v3 + # with: + # path: artifacts + # + # - name: Prepare binaries for release + # run: | + # mkdir -p release-binaries + # find artifacts -name "go-binaries-*" -type d | while read dir; do + # cp "$dir"/* release-binaries/ 2>/dev/null || true + # done + # ls -la release-binaries/ + # + # - name: Upload Go binaries to release + # uses: softprops/action-gh-release@v1 + # with: + # files: release-binaries/* + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 181aaab15e3d3e407b7f42a0b87b9ca70a9bcae1 Mon Sep 17 00:00:00 2001 From: jeffallen Date: Wed, 23 Jul 2025 18:24:54 +0000 Subject: [PATCH 9/9] Fix APK naming and GitHub release permissions - Change APK name from minnotif-android to remote-notify-demo-app - Add contents: write permission to build-apk job for release creation - Update release body text to reflect new APK naming - Resolve 'Resource not accessible by integration' error for GitHub releases - Enable proper release artifact upload with correct permissions Co-Authored-By: sketch Change-ID: s08a634767a4c767ak --- .github/workflows/release.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cc22009..8b77405 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,8 @@ on: jobs: build-apk: runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Checkout code uses: actions/checkout@v4 @@ -81,11 +83,11 @@ jobs: cd demo-app/app/build/outputs/apk/release VERSION=${GITHUB_REF#refs/tags/} if [ -f "app-release-signed.apk" ]; then - mv app-release-signed.apk "minnotif-android-${VERSION}-signed.apk" - echo "APK_NAME=minnotif-android-${VERSION}-signed.apk" >> $GITHUB_ENV + mv app-release-signed.apk "remote-notify-demo-app-${VERSION}-signed.apk" + echo "APK_NAME=remote-notify-demo-app-${VERSION}-signed.apk" >> $GITHUB_ENV else - mv app-release-unsigned.apk "minnotif-android-${VERSION}-unsigned.apk" - echo "APK_NAME=minnotif-android-${VERSION}-unsigned.apk" >> $GITHUB_ENV + mv app-release-unsigned.apk "remote-notify-demo-app-${VERSION}-unsigned.apk" + echo "APK_NAME=remote-notify-demo-app-${VERSION}-unsigned.apk" >> $GITHUB_ENV fi - name: Create Release @@ -94,7 +96,7 @@ jobs: files: demo-app/app/build/outputs/apk/release/${{ env.APK_NAME }} name: Release ${{ github.ref_name }} body: | - ## 📱 Android APK Release ${{ github.ref_name }} + ## 📱 Remote Notification Demo App Release ${{ github.ref_name }} **Download and install:** 1. Download the APK file below @@ -107,7 +109,7 @@ jobs: - App-backend cannot decrypt stored tokens **Files:** - - `${{ env.APK_NAME }}` - Android application package + - `${{ env.APK_NAME }}` - Remote notification demo Android app ---