1
+ ---
2
+ name : Generate Helm Spec Docs
3
+ on :
4
+ repository_dispatch : # Allows other repositories to trigger this workflow
5
+ types : [generate-helm-spec-docs]
6
+ workflow_dispatch : # Allows manual trigger of the workflow
7
+ jobs :
8
+ trigger :
9
+ runs-on : ubuntu-latest
10
+ permissions :
11
+ id-token : write
12
+ contents : read
13
+ steps :
14
+ - uses : aws-actions/configure-aws-credentials@v4
15
+ with :
16
+ aws-region : ${{ vars.RP_AWS_CRED_REGION }}
17
+ role-to-assume : arn:aws:iam::${{ secrets.RP_AWS_CRED_ACCOUNT_ID }}:role/${{ vars.RP_AWS_CRED_BASE_ROLE_NAME }}${{ github.event.repository.name }}
18
+ - uses : aws-actions/aws-secretsmanager-get-secrets@v2
19
+ with :
20
+ secret-ids : |
21
+ ,sdlc/prod/github/actions_bot_token
22
+ parse-json-secrets : true
23
+ # Download the helm-docs tool which generates documentation from Helm charts.
24
+ - name : Download helm-docs
25
+ run : |
26
+ curl -sL https://github.com/norwoodj/helm-docs/releases/download/v1.14.2/helm-docs_1.14.2_Linux_x86_64.tar.gz | tar xz
27
+ # Add the helm-docs tool to the system's PATH for easy access.
28
+ - name : Add helm-docs to $PATH
29
+ run : |
30
+ echo "helm-docs" >> $GITHUB_PATH
31
+ sudo mv helm-docs /usr/local/bin/
32
+ # Checkout the main branch of the helm-charts repository.
33
+ - name : Checkout helm-charts repository
34
+ uses : actions/checkout@v4
35
+ with :
36
+ repository : redpanda-data/helm-charts
37
+ ref : main
38
+ path : helm-charts
39
+ token : ${{ env.ACTIONS_BOT_TOKEN }}
40
+ # Generate the Helm documentation using the helm-docs tool.
41
+ - name : Generate Helm docs
42
+ run : |
43
+ helm-docs
44
+ working-directory : ./helm-charts
45
+ # Install pandoc, a tool to convert between different markup formats.
46
+ - name : Install pandoc
47
+ run : |
48
+ sudo apt-get install pandoc
49
+ # Checkout the main branch of the redpanda-docs repository.
50
+ - name : Checkout documentation repository
51
+ uses : actions/checkout@v4
52
+ with :
53
+ repository : redpanda-data/rp-connect-docs
54
+ ref : main
55
+ path : redpanda-docs
56
+ token : ${{ env.ACTIONS_BOT_TOKEN }}
57
+ # Convert the generated Markdown Helm documentation to AsciiDoc format using pandoc.
58
+ - name : Convert Markdown to AsciiDoc
59
+ run : |
60
+ pandoc ./helm-charts/charts/connect/README.md -t asciidoc -o ./redpanda-docs/modules/reference/pages/k-connect-helm-spec.adoc
61
+ - name : Modify third-level headings format
62
+ run : |
63
+ sed -i 's/\(\[[0-9]*\)\]\./\1\\]\./g' ./redpanda-docs/modules/reference/pages/k-connect-helm-spec.adoc
64
+ sed -i 's/=== \(http\([^[]\|\%5[BbDd]\)*\)\[\([^]]*\)\]/=== link:++\1++\[\3\]/' ./redpanda-docs/modules/reference/pages/k-connect-helm-spec.adoc
65
+ - name : Correct AsciiDoc format
66
+ run : |
67
+ # Correct the title format
68
+ sed -i 's/^== # \(.*\)/= \1/' ./redpanda-docs/modules/reference/pages/k-connect-helm-spec.adoc
69
+ # Correct the description format
70
+ sed -i 's/^== description: \(.*\)/:description: \1/' ./redpanda-docs/modules/reference/pages/k-connect-helm-spec.adoc
71
+ # Check if any changes were made in the documentation.
72
+ - name : Check if changes were made
73
+ id : check_changes
74
+ run : |
75
+ cd ./redpanda-docs
76
+ changes=$(git status --porcelain)
77
+ if [ -z "$changes" ]; then
78
+ echo "has_changes=false" >> $GITHUB_ENV
79
+ else
80
+ echo "has_changes=true" >> $GITHUB_ENV
81
+ fi
82
+ # If changes were detected, commit those changes.
83
+ - name : Commit changes
84
+ if : env.has_changes == 'true'
85
+ run : |
86
+ cd ./redpanda-docs
87
+ git config --global user.email "[email protected] "
88
+ git config --global user.name "vbotbuildovich"
89
+ git add modules/reference/*
90
+ git commit -m "auto-docs: Update Helm spec"
91
+ git push origin main
92
+ env :
93
+ ACCESS_TOKEN : ${{ env.ACTIONS_BOT_TOKEN }}
0 commit comments