Documentation deploy build.

To simplify the release process we are reusing the api documents build
during post-submit. This will help us make the 3P release process more
deterministic and removing ~1h from the release process.

Bug: https://github.com/flutter/flutter/issues/81855
Change-Id: If292decddce99d5f2513110f01b745193ff52173
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/34260
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
Reviewed-by: Keyong Han <keyonghan@google.com>
diff --git a/recipe_modules/adhoc_validation/api.py b/recipe_modules/adhoc_validation/api.py
index b036157..67fa7f4 100644
--- a/recipe_modules/adhoc_validation/api.py
+++ b/recipe_modules/adhoc_validation/api.py
@@ -17,7 +17,7 @@
     """Returns the list of accepted validations."""
     return [
         'analyze', 'customer_testing', 'docs', 'fuchsia_precache',
-        'verify_binaries_codesigned',
+        'verify_binaries_codesigned', 'docs_deploy'
     ]
 
   def run(self, name, validation, env, env_prefixes, secrets=None):
@@ -60,9 +60,12 @@
       else:
         with self.m.context(env=env, env_prefixes=env_prefixes):
           self.m.test_utils.run_test(validation, [resource_name])
-          if validation == 'docs' and self.m.properties.get('firebase_project'):
+          if ((validation == 'docs' and self.m.properties.get('firebase_project')) or
+              (validation == 'docs_deploy') and self.m.properties.get('firebase_project')):
             docs_path = checkout_path.join('dev', 'docs')
-            self.m.bucket_util.upload_folder('Upload API Docs', docs_path, 'doc', "api_docs.zip")
+            # Do not upload on docs_deploy.
+            if not validation == 'docs_deploy':
+              self.m.bucket_util.upload_folder('Upload API Docs', docs_path, 'doc', "api_docs.zip")
             project = self.m.properties.get('firebase_project')
             self.m.firebase.deploy_docs(
                 env=env,
diff --git a/recipe_modules/adhoc_validation/resources/docs_deploy.sh b/recipe_modules/adhoc_validation/resources/docs_deploy.sh
new file mode 100644
index 0000000..24040c5
--- /dev/null
+++ b/recipe_modules/adhoc_validation/resources/docs_deploy.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# Copyright 2022 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# Script to generate and upload flutter docs.
+
+set -e
+
+dart ./dev/bots/post_process_docs.dart