This tool uploads documentation for publishing to googleapis.dev
and cloud.google.com (see
doc-pipeline for more info).
You can install docuploader with:
pip install gcp-docuploader
There are two steps for uploading docs:
-
Create a metadata file. See
metadata.protofor the format.- You can use
docuploader create-metadatato create adocs.metadatafile. - Alternatively, you can create a
docs.metadata.jsonfile independently.
- You can use
-
Upload the docs with
docuploader upload:Usage: docuploader upload [OPTIONS] DOCUMENTATION_PATH Options: --staging-bucket TEXT The bucket to upload the staged documentation to. --credentials TEXT Path to the credentials file to use for Google Cloud Storage. --metadata-file TEXT Path to the docs.metadata file. The path must be relative to the CWD. --destination-prefix TEXT Prefix to include when uploading tar file. A - will be added after the prefix, if there is one. --help Show this message and exit.docuploader will take the documentation in
DOCUMENTATION_PATH,docs.metadataordocs.metadata.jsonand create a tarball (tgz), then send the tarball to the bucket specified in--staging-bucketoption with a prefix specified in--destination-prefix.
docuploader can use ADC (Application Default Credentials) or a given service account. To use ADC, run gcloud auth application-default login prior to upload to gain credentials.
For an example of using docuploader, see
example usage in googleapis/google-cloud-go.
The tarballs containing DocFX YAML files must adhere to the following requirements:
-
The tarball must contain metadata in the form of the
Metadatamessage frommetadata.proto. This can be represented in protobuf text format in a file calleddocs.metadata, or in protobuf JSON format in a file calleddocs.metadata.json. -
docs.metadataordocs.metadata.jsonmust havenameversionlanguage
See
metadata.protofor other supported fields. -
toc.ymlortoc.htmlfile exists at the root directory or in special subdirectories (./api/toc.yml). -
documentation files may either be in
- Root directory (
./page1.yml,./page2.yml) - Subdirectories (
./product/page1.yml,./product/page2.yml) - Special subdirectories (
./api,./examples)
Note: If you use special subdirectories, only use special subdirectories and do not place documentation in the root or other subdirectories.
- Root directory (
(1) and (2) will be checked and enforced if you use docuploader upload.