generated from mintlify/starter
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (73 loc) · 3.02 KB
/
update-cli-docs.yml
File metadata and controls
86 lines (73 loc) · 3.02 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
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: 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 README.md.gotmpl,_templates.gotmpl
mkdir -p $GITHUB_WORKSPACE/helm
cp /tmp/cli-repo/charts/k8s-reporter/README.md $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