Check out the repository, then run the following commnads:
curl -o Makefile.api https://raw.githubusercontent.com/stolostron/api-documentation/main/Makefile && \
grep -q 'include Makefile.api' Makefile || sed -i '1i # See https://github.com/stolostron/api-documentation/blob/main/DEVELOPMENT.md for Makefile.api usage instructions\ninclude Makefile.api' Makefile
Now run
SEARCH_DIR=<path_to_crds_or_type.go> make gen-api-docs
Commit and push the changes.
For the first time setup, you need to download the GitHub workflow action and set up the automation:
-
Create the workflows directory (if it doesn't exist):
mkdir -p .github/workflows
-
Download the workflow file:
curl -o .github/workflows/generate-api-docs-release-2.14.yml https://raw.githubusercontent.com/stolostron/api-documentation/refs/heads/main/workflows/generate-api-docs-release-2.14.yml
-
Rename and edit the workflow file:
mv .github/workflows/generate-api-docs-release-2.14.yml .github/workflows/generate-api-docs-release-{version}.yml -
Edit the workflow file:
- Open
.github/workflows/generate-api-docs-release-{version}.ymlin your editor - Update the environment variables to match your release:
env: RELEASE_BRANCH: 'release-{version}' PATH: '<path_to_crds_or_type.go>'
- Open
-
Commit the workflow to your default branch:
git add .github/workflows/generate-api-docs-release-{version}.yml git commit -m "chore: add API docs workflow for release-{version}}" git push origin main # This is done because the workflows are only run from the default branch
Once committed to your default branch, the API documentation will start to be generated daily automatically.
To add a new release, follow these steps:
-
Clone the main branch of the repository:
git clone https://github.com/stolostron/api-documents.git cd api-documents git checkout main -
Create and checkout a new branch for the release: Replace
release-2.15.0with your desired release branch name.git checkout -b release-2.15
-
Copy the existing workflow to the new release version:
cp .github/workflows/generate-api-docs-release-2.14.yml .github/workflows/generate-api-docs-release-2.15.yml
-
Edit the new workflow file:
- Open
.github/workflows/generate-api-docs-release-2.15.ymlin your editor. - Update the
RELEASE_BRANCHandBACKPLANE_BRANCHenvironment variables to match your new release. For example:env: RELEASE_BRANCH: 'release-2.15.0' BACKPLANE_BRANCH: 'backplane-2.10.0'
- Optionally, update the workflow
name:at the top for clarity. - Make sure the release version matches the current release branch you are working on.
- Open
-
Commit and push your changes:
git add .github/workflows/generate-api-docs-release-2.15.yml git commit -m "chore: add API docs workflow for release-2.15" git push origin release-2.15 -
Merge the change back to main:
- Switch back to the
mainbranch:git checkout main
- Merge the release branch:
git merge release-2.15
- Push the updated
mainbranch:git push origin main
- Switch back to the
Once the workflow is committed to your default branch, the APIs will start to be generated daily automatically.
This ensures the new GitHub Action workflow is available and will be used for the new release branch.