-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (88 loc) · 3.68 KB
/
Copy pathupdate-cli-docs.yml
File metadata and controls
103 lines (88 loc) · 3.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Update Reference Docs
on:
workflow_dispatch:
inputs:
kosli_cli_tag:
description: 'CLI release tag (vX.Y.Z)'
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@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
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@v7
- 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
mkdir -p $GITHUB_WORKSPACE/helm/k8s_reporter
rm -f $GITHUB_WORKSPACE/helm/k8s_reporter/*.mdx
for tmpl in mintlify/*.md.gotmpl; do
page=$(basename "$tmpl" .md.gotmpl)
helm-docs \
--template-files "${tmpl},_templates.gotmpl,_mintlify_templates.gotmpl" \
--output-file "${page}.generated.md"
# helm-docs leaves a trailing blank line; normalize to a single final newline
printf '%s\n' "$(cat "${page}.generated.md")" \
> "$GITHUB_WORKSPACE/helm/k8s_reporter/${page}.mdx"
rm "${page}.generated.md"
done
- 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