diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..b90ca61 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,132 @@ +name: .NET MAUI CI/CD Pipeline + +on: + push: + branches: + - main + pull_request: + +jobs: + build-android: + name: Build Android APK + runs-on: ubuntu-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 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 + + - name: Upload Android Build Artifact + uses: actions/upload-artifact@v3 + with: + 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@v3 + with: + name: iOS-IPA + path: ./publish/App.ipa + + deploy-android: + name: Deploy to Google Play + runs-on: ubuntu-latest + needs: build-android + + steps: + - name: Download Android APK + uses: actions/download-artifact@v3 + with: + name: Android-APK + path: ./publish + + - 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 + run: | + fastlane deliver --ipa "./publish/App.ipa" \ + --username "${{ secrets.APPLE_ID }}" \ + --app_identifier "com.icarda.feedapp" \ + --skip_screenshots \ + --force + + notify-team: + name: Notify Team + runs-on: ubuntu-latest + needs: [deploy-android, deploy-ios] + + 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"