From 5fca305ca669058ff1723d5387479b380f301927 Mon Sep 17 00:00:00 2001 From: icarda-git <47320559+icarda-git@users.noreply.github.com> Date: Thu, 27 Feb 2025 17:00:51 +0300 Subject: [PATCH 1/3] Fix deprecated upload-artifact v3 upload-artifact v3 is deprecated and was updated to upload-artifact v4 --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b90ca61..b93a217 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,7 +35,7 @@ jobs: mv ./publish/*.apk ./publish/App.apk # Rename output file - name: Upload Android Build Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Android-APK path: ./publish/App.apk @@ -69,7 +69,7 @@ jobs: mv ./publish/*.ipa ./publish/App.ipa # Rename output file - name: Upload iOS Build Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: iOS-IPA path: ./publish/App.ipa From 5dc8c61b43ca6478135f0c06ebe81ce590f4872c Mon Sep 17 00:00:00 2001 From: icarda-git <47320559+icarda-git@users.noreply.github.com> Date: Thu, 13 Mar 2025 09:03:35 +0000 Subject: [PATCH 2/3] Updated pipelines that use google workload Identity federation rather than API keys --- .github/workflows/main.yml | 104 +++++++++++++++---------------------- 1 file changed, 42 insertions(+), 62 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b93a217..ff67e27 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ on: jobs: build-android: - name: Build Android APK + name: Build and Test Android APK runs-on: ubuntu-latest steps: @@ -26,13 +26,31 @@ jobs: - name: Restore Dependencies run: dotnet restore + - name: Run Tests with Code Coverage + run: dotnet test --collect:"XPlat Code Coverage" --logger trx --results-directory ./TestResults + + - name: Install ReportGenerator + run: dotnet tool install --global dotnet-reportgenerator-globaltool + + - name: Generate Code Coverage Report + run: | + reportgenerator -reports:./TestResults/*/coverage.cobertura.xml \ + -targetdir:./TestResults/CoverageReport \ + -reporttypes:Html + + - name: Upload Test and Coverage Reports + uses: actions/upload-artifact@v4 + with: + name: Code-Coverage-Report + path: ./TestResults/CoverageReport + - name: Build Android App run: dotnet build -f net8.0-android -c Release - name: Create Android APK run: | dotnet publish -f net8.0-android -c Release -o ./publish - mv ./publish/*.apk ./publish/App.apk # Rename output file + mv ./publish/*.apk ./publish/App.apk - name: Upload Android Build Artifact uses: actions/upload-artifact@v4 @@ -40,44 +58,13 @@ jobs: name: Android-APK path: ./publish/App.apk - build-ios: - name: Build iOS IPA - runs-on: macos-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - - name: Setup .NET SDK - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '8.0.x' - - - name: Install MAUI Workload - run: dotnet workload install maui - - - name: Restore Dependencies - run: dotnet restore - - - name: Build iOS App - run: dotnet build -f net8.0-ios -c Release - - - name: Create iOS IPA - run: | - mkdir -p ./publish - dotnet publish -f net8.0-ios -c Release -o ./publish - mv ./publish/*.ipa ./publish/App.ipa # Rename output file - - - name: Upload iOS Build Artifact - uses: actions/upload-artifact@v4 - with: - name: iOS-IPA - path: ./publish/App.ipa - deploy-android: name: Deploy to Google Play runs-on: ubuntu-latest needs: build-android + permissions: + contents: 'read' + id-token: 'write' steps: - name: Download Android APK @@ -86,47 +73,40 @@ jobs: name: Android-APK path: ./publish + - name: Authenticate with Google Cloud using Workload Identity Federation + uses: google-github-actions/auth@v2 + with: + workload_identity_provider: projects/${{ secrets.GCP_PROJECT_NUMBER }}/locations/global/workloadIdentityPools/${{ secrets.WORKLOAD_IDENTITY_POOL }}/providers/${{ secrets.WORKLOAD_IDENTITY_PROVIDER }} + service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} + + - name: Debug - Verify Authentication + run: | + echo "🔍 Listing Google Cloud authenticated identities..." + gcloud auth list + echo "🔍 Checking available projects..." + gcloud projects list + - name: Deploy to Google Play Store (Beta) uses: r0adkll/upload-google-play@v1 with: - serviceAccountJson: ${{ secrets.GOOGLE_PLAY_API_KEY }} packageName: "com.icarda.feedapp" releaseFiles: "./publish/App.apk" track: beta status: completed - deploy-ios: - name: Deploy to App Store Connect (TestFlight) - runs-on: macos-latest - needs: build-ios - - steps: - - name: Download iOS IPA - uses: actions/download-artifact@v3 - with: - name: iOS-IPA - path: ./publish - - - name: Setup Fastlane - run: | - gem install fastlane - - - name: Deploy to TestFlight + - name: Debug - Check Google Cloud Logs run: | - fastlane deliver --ipa "./publish/App.ipa" \ - --username "${{ secrets.APPLE_ID }}" \ - --app_identifier "com.icarda.feedapp" \ - --skip_screenshots \ - --force + echo "🔍 Fetching Workload Identity Pool logs..." + gcloud logging read "resource.type=identity_pool" notify-team: name: Notify Team runs-on: ubuntu-latest - needs: [deploy-android, deploy-ios] + needs: deploy-android steps: - name: Send Teams Notification run: | curl -H "Content-Type: application/json" \ - -d '{"text": "🚀 New MAUI App build deployed to Google Play & TestFlight! 🎉"}' \ - -X POST "https://outlook.office.com/webhook/YOUR_WEBHOOK_URL" + -d '{"text": "🚀 New MAUI App build deployed to Google Play! 🎉"}' \ + -X POST "https://outlook.office.com/webhook/YOUR_WEBHOOK_URL" From 5e6b0167925b0594684000654010e51400d6e01f Mon Sep 17 00:00:00 2001 From: icarda-git <47320559+icarda-git@users.noreply.github.com> Date: Sun, 16 Mar 2025 09:40:06 +0000 Subject: [PATCH 3/3] Trigger CI/CD pipeline test