cli-release #32
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: Harden Runner | |
| uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1 | |
| with: | |
| egress-policy: audit | |
| - 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@v6 | |
| - 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 --dir client_reference/ | |
| rm -f kosli | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.14' | |
| - name: Install Python dependencies | |
| run: pip install pyyaml requests | |
| - 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 | |
| run: python scripts/update-cli-nav.py --docs-dir client_reference/ --nav-file config/navigation.json | |
| - name: Add live-docs sections | |
| run: python scripts/add_livedocs.py | |
| - 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: | | |
| git clone --sparse --filter=blob:none --depth=1 \ | |
| --branch ${{ steps.tag.outputs.cli_tag }} \ | |
| https://github.com/kosli-dev/cli.git /tmp/cli-repo | |
| cd /tmp/cli-repo && git sparse-checkout set charts/k8s-reporter | |
| cd /tmp/cli-repo/charts/k8s-reporter | |
| helm-docs --template-files MINTLIFY.md.gotmpl,_templates.gotmpl,_mintlify_templates.gotmpl | |
| mkdir -p $GITHUB_WORKSPACE/helm | |
| cp /tmp/cli-repo/charts/k8s-reporter/README.md $GITHUB_WORKSPACE/helm/k8s_reporter.mdx | |
| - 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 |