deployHostingRelease method

Future<bool> deployHostingRelease()

Deploy to Firebase Hosting (release target)

Implementation

Future<bool> deployHostingRelease() async {
  info('Deploying to Firebase Hosting (release)...');
  final String? projectId = _requireFirebaseProjectId();
  if (projectId == null) {
    return false;
  }

  final ProcessResult? result = await _runner.runWithRetry(
    'firebase',
    <String>['deploy', '--only', 'hosting:release', '--project', projectId],
    workingDirectory: config.outputDir,
    environment: _authEnvironment,
    operationName: 'Deploy Hosting (release)',
  );

  if (result != null && result.success) {
    return true;
  }

  // Fallback for projects that only use a default hosting target.
  warn(
    'Release hosting target deploy failed; retrying default hosting deploy.',
  );
  final ProcessResult? fallbackResult = await _runner.runWithRetry(
    'firebase',
    <String>['deploy', '--only', 'hosting', '--project', projectId],
    workingDirectory: config.outputDir,
    environment: _authEnvironment,
    operationName: 'Deploy Hosting (default)',
  );

  return fallbackResult != null && fallbackResult.success;
}