@@ -154,45 +154,52 @@ jobs:
154154 exit 1
155155 }
156156
157- # 🆕 NEW: Setup Google Cloud SDK for Google Play API access
158- - name : Setup Google Cloud SDK
159- uses : google-github-actions/setup-gcloud@v1
157+ # 🔧 FIXED: Proper Google Cloud Authentication
158+ - name : Authenticate with Google Cloud
159+ uses : google-github-actions/auth@v2
160160 with :
161- service_account_key : ${{ secrets.GCP_CREDENTIALS }}
161+ credentials_json : ${{ secrets.GCP_CREDENTIALS }}
162162 project_id : feed-optimisation-app
163- export_default_credentials : true
164163
165- # 🆕 NEW: Enable Google Play Android Developer API
164+ # 🔧 FIXED: Setup Google Cloud SDK (after authentication)
165+ - name : Setup Google Cloud SDK
166+ uses : google-github-actions/setup-gcloud@v2
167+
168+ # 🔧 FIXED: Enable Google Play API with proper authentication
166169 - name : Enable Google Play Android Developer API
167170 shell : pwsh
168171 run : |
169172 Write-Host "=== Google Play API Configuration ==="
170173
174+ # Verify authentication first
175+ Write-Host "Verifying authentication..."
176+ try {
177+ $authList = gcloud auth list --format="value(account)" 2>$null
178+ Write-Host "✅ Authenticated accounts: $authList"
179+ } catch {
180+ Write-Warning "Authentication check failed, but continuing..."
181+ }
182+
171183 # Enable the Google Play Android Developer API
172184 Write-Host "Enabling Google Play Android Developer API..."
173- gcloud services enable androidpublisher.googleapis.com
174-
175- # Verify the API is enabled
176- Write-Host "Verifying API is enabled..."
177- $enabledServices = gcloud services list --enabled --filter="name:androidpublisher.googleapis.com" --format="value(config.name)"
178- if ($enabledServices -like "*androidpublisher*") {
179- Write-Host "✅ Google Play Android Developer API is enabled"
180- } else {
181- Write-Warning "⚠️ API might not be fully enabled yet (can take a few moments)"
185+ try {
186+ gcloud services enable androidpublisher.googleapis.com --quiet
187+ Write-Host "✅ Google Play Android Developer API enabled"
188+ } catch {
189+ Write-Warning "⚠️ API enable command failed, but may already be enabled"
182190 }
183191
184- # Verify authentication
185- Write-Host "Verifying authentication..."
186- $authAccount = gcloud auth list --filter=status:ACTIVE --format="value(account)"
187- Write-Host "Active service account: $authAccount"
188-
189- # Test API access (optional but helpful for debugging)
190- Write-Host "Testing Google Cloud authentication..."
192+ # Verify the API is enabled
193+ Write-Host "Verifying API status..."
191194 try {
192- gcloud auth application-default print-access-token | Out-Null
193- Write-Host "✅ Authentication successful"
195+ $enabledServices = gcloud services list --enabled --filter="name:androidpublisher.googleapis.com" --format="value(config.name)" 2>$null
196+ if ($enabledServices -like "*androidpublisher*") {
197+ Write-Host "✅ Google Play Android Developer API is confirmed enabled"
198+ } else {
199+ Write-Host "⚠️ API status unclear, but proceeding with deployment"
200+ }
194201 } catch {
195- Write-Warning "⚠️ Authentication test failed , but may still work for Google Play upload "
202+ Write-Host "⚠️ Could not verify API status , but proceeding "
196203 }
197204
198205 Write-Host "✅ Google Play API setup completed"
@@ -225,7 +232,7 @@ jobs:
225232 Write-Host "📦 Package: com.icarda.feedapp"
226233 Write-Host "✅ All files are ready for beta track deployment"
227234
228- # 🔥 DEPLOY: Beta track deployment with enhanced configuration
235+ # 🚀 DEPLOY: Beta track deployment with enhanced configuration
229236 - name : Deploy to Google Play Store (Beta Track)
230237 uses : r0adkll/upload-google-play@v1.1.3
231238 with :
0 commit comments