This orb automates the process of merging Docusaurus documentation from multiple repositories into a single target repository.
- Clone Target Repository: Clones the target Docusaurus documentation repository to the CI environment.
- Check for Docs: Verifies that documentation files exist in the source repository.
- Copy Docs: Copies documentation from the source repository to the cloned target repository.
- Move Static Content: Moves any static content to the appropriate directory in the target repository.
- Generate category.json: Creates a
_category_.json
file for new documentation sections. - Commit and Push: Commits the changes and pushes them to the target repository.
- Streamlined documentation consolidation
- Configurable paths and labels
- Automatic
_category_.json
creation
- CircleCI account
- A Docusaurus documentation repository
- A Machine User with sufficent permissions in both the source and target repos
Note
For the orb to work the CircleCI project must have a User Key with:
- READ permissions for the Source repo
- READ/WRITE permissions for the Target repo
Parameter | Type | Description |
---|---|---|
git_email |
String | Email for Git configuration. |
git_username |
String | Username for Git configuration. |
target_repo |
String | The GitHub repository URL where the documentation resides. |
description |
String | Short description of the package used in indexes etc. Default is an empty string. |
label |
String | The label that will appear in the sidebar of the docs site. Default is "package-name". |
project_name |
String | The path where these documents will be located on the docs site. Default is an empty string. |
source_docs_dir |
String | The path to the directory containing the source markdown files. Default is "./docs". |
Here's a simple example demonstrating how to use the orb:
version: 2.1
orbs:
publish-docs: infinitered/[email protected] # Replace with the actual version
workflows:
build_docs:
jobs:
- publish-docs/build_docs:
description: "The description that will appear on autogenerated indexes and components."
git_email: "[email protected]"
git_username: "Your CI Username"
label: "The label that will appear in the sidebar of the docs site."
project_name: 'name-of-project'
source_docs_dir: "docs"
source_repo_directory: "source"
target_docs_dir: "docs"
target_repo: "[email protected]:your-org/your-repo.git"
target_repo_directory: "target"
publish_to_docs_site:
jobs:
- publish-docs/publish_docs:
description: "The description that will appear on autogenerated indexes and components."
git_email: "[email protected]"
git_username: "Your CI Username"
label: "The label that will appear in the sidebar of the docs site."
project_name: 'name-of-project'
source_docs_dir: "docs"
source_repo_directory: "source"
target_docs_dir: "docs"
target_repo: "[email protected]:your-org/your-repo.git"
target_repo_directory: "target"
In your source repository, static files such as images should be placed in a directory named _static_
under
your docs
folder. The directory structure will look like this when you run the tree
command:
docs/
├── part-one.md
├── part-two.md
└── _static_
└── image.png
During the documentation merge process, the orb will automatically move the contents of _static_
to the appropriate
location in the target repository.
Before Merge:
source-repo/
└── docs/
│ ├── part-one.md
│ └── part-two.md
└── _static_/
└── image.png
After Merge:
target-repo/
├── docs/
│ └── <<project-name>>
│ ├── part-one.md
│ └── part-two.md
└── static/
└── <<project-name>>
└── image.png
By following this convention, you ensure that all static files and documents are correctly placed in the target
repository, under docs/<<project-name>>
for documents and static/<<project-name>>
for static files.
Clones the target documentation repository to ~/target_repo
.
Parameter | Type | Description |
---|---|---|
target_repo |
String | The GitHub repository URL where the documentation resides. |
Commits and pushes the updated documentation to the target repository.
None
Clones a Docusaurus repo and adds the docs from the current repo to the target repository.
Parameter | Type | Description |
---|---|---|
description |
String | Short description of the package. Default is an empty string. |
label |
String | The label for the sidebar. Default is "package-name". |
project_name |
String | The path where the documents will be located on the docs site. |
source_docs_dir |
String | The path to the directory containing the source markdown files. Default is "./docs". |
target_docs_path |
String | The path to the directory in the target repo where docs will be copied. Default is "./docs". |
Installs Git on the CI environment.
None
Configures Git for commit and push operations.
Parameter | Type | Description |
---|---|---|
git_email |
String | Email for Git configuration. |
git_username |
String | Username for Git configuration. |
Validates that all required parameters are set.
Parameter | Type | Description |
---|---|---|
description |
String | Short description of the package. |
git_email |
String | Email for Git configuration. |
git_username |
String | Username for Git configuration. |
label |
String | The label for the sidebar. |
project_name |
String | The path where the documents will be located on the docs site. |
target_repo |
String | The GitHub repository URL where the documentation resides. |