1
+ name : k8s_apis_sync
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ inputs :
6
+ release :
7
+ type : string
8
+ required : true
9
+ description : ' '
10
+
11
+ jobs :
12
+ k8s_apis_sync :
13
+ runs-on : ubuntu-latest
14
+ steps :
15
+ - name : ' Checkout'
16
+ uses : actions/checkout@v3
17
+
18
+ - name : ' Install crdoc'
19
+ run : |-
20
+ curl -LO https://github.com/fybrik/crdoc/releases/download/v0.6.3/crdoc_Linux_x86_64.tar.gz
21
+ tar -xvzf crdoc_Linux_x86_64.tar.gz
22
+ sudo mv crdoc /bin/crdoc
23
+
24
+ - name : ' Fetch release'
25
+ run : |-
26
+ RELEASE="${{ github.event.inputs.release }}"
27
+ aws s3 cp s3://redislabs-k8s/${RELEASE}/ --no-sign-request . --recursive --region us-east-1
28
+
29
+ tar xf redis-enterprise-operator-*.tar.gz
30
+
31
+ - name : ' Generate READMEs'
32
+ run : |-
33
+ mkdir artifacts
34
+ mkdir templates
35
+ cp content/operate/kubernetes/reference/kubernetes-api-reference-template.tmpl templates/template.tmpl
36
+
37
+ crdoc --resources crds/reaadb_crd.yaml --output artifacts/redis_enterprise_active_active_database_api.md --template templates/template.tmpl
38
+ sed -E -i 's/^### RedisEnterpriseActiveActiveDatabase\./### /g' artifacts/redis_enterprise_active_active_database_api.md
39
+ sed -E -i 's/^<sup><sup>\[↩ Parent\]\(#redisenterpriseactiveactivedatabase/<sup><sup>\[↩ Parent\]\(#/g' artifacts/redis_enterprise_active_active_database_api.md
40
+ sed -E -i 's/<td><b><a href="#redisenterpriseactiveactivedatabase/<td><b><a href="#/' artifacts/redis_enterprise_active_active_database_api.md
41
+
42
+ crdoc --resources crds/rec_crd.yaml --output artifacts/redis_enterprise_cluster_api.md --template templates/template.tmpl
43
+ sed -E -i 's/^### RedisEnterpriseCluster\./### /g' artifacts/redis_enterprise_cluster_api.md
44
+ sed -E -i 's/^<sup><sup>\[↩ Parent\]\(#redisenterprisecluster/<sup><sup>\[↩ Parent\]\(#/g' artifacts/redis_enterprise_cluster_api.md
45
+ sed -E -i 's/<td><b><a href="#redisenterprisecluster/<td><b><a href="#/' artifacts/redis_enterprise_cluster_api.md
46
+
47
+ crdoc --resources crds/redb_crd.yaml --output artifacts/redis_enterprise_database_api.md --template templates/template.tmpl
48
+ sed -E -i 's/^### RedisEnterpriseDatabase\./### /g' artifacts/redis_enterprise_database_api.md
49
+ sed -E -i 's/^<sup><sup>\[↩ Parent\]\(#redisenterprisedatabase/<sup><sup>\[↩ Parent\]\(#/g' artifacts/redis_enterprise_database_api.md
50
+ sed -E -i 's/<td><b><a href="#redisenterprisedatabase/<td><b><a href="#/' artifacts/redis_enterprise_database_api.md
51
+
52
+ crdoc --resources crds/rerc_crd.yaml --output artifacts/redis_enterprise_remote_cluster.md --template templates/template.tmpl
53
+ sed -E -i 's/^### RedisEnterpriseRemoteCluster\./### /g' artifacts/redis_enterprise_remote_cluster.md
54
+ sed -E -i 's/^<sup><sup>\[↩ Parent\]\(#redisenterpriseremotecluster/<sup><sup>\[↩ Parent\]\(#/g' artifacts/redis_enterprise_remote_cluster.md
55
+ sed -E -i 's/<td><b><a href="#redisenterpriseremotecluster/<td><b><a href="#/' artifacts/redis_enterprise_remote_cluster.md
56
+
57
+ - name : ' Send pull request'
58
+ env :
59
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
60
+ run : |-
61
+ RELEASE="${{ github.event.inputs.release }}"
62
+ BRANCH="k8s_apis_docs_${RELEASE}"
63
+
64
+ # Setup git email and username
65
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
66
+ git config user.name "github-actions[bot]"
67
+ git config --global "url.https://${GH_TOKEN}@github.com/.insteadOf" https://github.com/
68
+
69
+ git checkout -b "${BRANCH}"
70
+
71
+ cp artifacts/redis_enterprise_active_active_database_api.md content/operate/kubernetes/reference/
72
+ cp artifacts/redis_enterprise_cluster_api.md content/operate/kubernetes/reference/
73
+ cp artifacts/redis_enterprise_database_api.md content/operate/kubernetes/reference/
74
+ cp artifacts/redis_enterprise_remote_cluster.md content/operate/kubernetes/reference/
75
+
76
+ git apply content/operate/kubernetes/reference/kubernetes-api-reference-frontmatter.patch
77
+
78
+ git add content/operate/kubernetes/reference/
79
+ git commit -m "k8s api docs ${RELEASE}"
80
+ git push origin "${BRANCH}"
81
+
82
+ gh pr create \
83
+ --body "k8s api docs ${RELEASE}" \
84
+ --title "k8s api docs ${RELEASE}" \
85
+ --head "$BRANCH" \
86
+ --base "main"
0 commit comments