Update Reference Docs #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Reference Docs | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| kosli_cli_tag: | |
| description: 'CLI release tag (e.g. v2.11.2)' | |
| required: true | |
| repository_dispatch: | |
| types: [cli-release] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Determine CLI tag | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "repository_dispatch" ]; then | |
| echo "cli_tag=${{ github.event.client_payload.kosli_cli_tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "cli_tag=${{ github.event.inputs.kosli_cli_tag }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Checkout docs repo | |
| uses: actions/checkout@v4 | |
| - name: Download kosli CLI from release | |
| run: | | |
| TAG="${{ steps.tag.outputs.cli_tag }}" | |
| curl -sL "https://github.com/kosli-dev/cli/releases/download/${TAG}/kosli_${TAG#v}_linux_amd64.tar.gz" | tar xz kosli | |
| chmod +x kosli | |
| - name: Generate Mintlify CLI docs | |
| run: | | |
| rm -f client_reference/kosli*.md | |
| DOCS=true ./kosli docs --mintlify --dir client_reference/ | |
| rm -f kosli | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install Python dependencies | |
| run: pip install pyyaml | |
| - name: Stamp CLI version in overview page | |
| run: | | |
| TAG="${{ steps.tag.outputs.cli_tag }}" | |
| sed -i "s/\*\*v[0-9][0-9.]*\*\*/**${TAG}**/" client_reference/overview.md | |
| - name: Update CLI navigation in docs.json | |
| run: python scripts/update-cli-nav.py --docs-dir client_reference/ --config docs.json | |
| - name: Checkout CLI repo at tag (sparse) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: kosli-dev/cli | |
| ref: refs/tags/${{ steps.tag.outputs.cli_tag }} | |
| sparse-checkout: charts/k8s-reporter | |
| path: cli-repo | |
| - name: Install helm-docs | |
| run: | | |
| curl -sL https://github.com/norwoodj/helm-docs/releases/download/v1.14.2/helm-docs_1.14.2_Linux_x86_64.deb --output helm-docs.deb | |
| sudo dpkg -i helm-docs.deb | |
| rm helm-docs.deb | |
| - name: Generate helm docs | |
| run: | | |
| cd $GITHUB_WORKSPACE/cli-repo/charts/k8s-reporter | |
| helm-docs --template-files README.md.gotmpl,_templates.gotmpl --output-file $GITHUB_WORKSPACE/helm/k8s_reporter.md | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| commit-message: "docs: update CLI and helm reference for ${{ steps.tag.outputs.cli_tag }}" | |
| title: "docs: update CLI and helm reference for ${{ steps.tag.outputs.cli_tag }}" | |
| body: | | |
| Automated update of CLI and Helm reference documentation for release `${{ steps.tag.outputs.cli_tag }}`. | |
| branch: reference-docs/${{ steps.tag.outputs.cli_tag }} | |
| delete-branch: true | |
| sign-commits: true |