uploadToGoogleDrive static method
Implementation
static Future<void> uploadToGoogleDrive(String artifactPath) async {
final config = Config().config;
final googleDriveConfig = config.uploadOptions.googleDrive;
final clientId = googleDriveConfig.clientId;
final clientSecret = googleDriveConfig.clientSecret;
if (!googleDriveConfig.enabled) {
return;
} else if (clientId == null) {
print(
'❌ Google Drive Client ID not found. Please check your config yaml file.');
return;
} else if (clientSecret == null) {
print(
'❌ Google Drive Client Secret not found. Please check your config yaml file.');
return;
}
final uploader = GoogleDriveUploader(
clientId: clientId,
clientSecret: clientSecret,
);
final bool isAuthenticated = await uploader.authenticate();
if (isAuthenticated) {
Helpers.showLoading('☁️ Uploading APK to Google Drive...');
await uploader.uploadToGoogleDrive(artifactPath);
Helpers.stopLoading();
} else {
print('Authentication failed. Please try again.');
exit(0);
}
}