-
Notifications
You must be signed in to change notification settings - Fork 150
86 lines (69 loc) · 4.38 KB
/
k8s_apis_sync.yaml
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: k8s_apis_sync
on:
workflow_dispatch:
inputs:
release:
type: string
required: true
description: ''
jobs:
k8s_apis_sync:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v3
- name: 'Install crdoc'
run: |-
curl -LO https://github.com/fybrik/crdoc/releases/download/v0.6.3/crdoc_Linux_x86_64.tar.gz
tar -xvzf crdoc_Linux_x86_64.tar.gz
sudo mv crdoc /bin/crdoc
- name: 'Fetch release'
run: |-
RELEASE="${{ github.event.inputs.release }}"
aws s3 cp s3://redislabs-k8s/${RELEASE}/ --no-sign-request . --recursive --region us-east-1
tar xf redis-enterprise-operator-*.tar.gz
- name: 'Generate READMEs'
run: |-
mkdir artifacts
mkdir templates
cp content/operate/kubernetes/reference/kubernetes-api-reference-template.tmpl templates/template.tmpl
crdoc --resources crds/reaadb_crd.yaml --output artifacts/redis_enterprise_active_active_database_api.md --template templates/template.tmpl
sed -E -i 's/^### RedisEnterpriseActiveActiveDatabase\./### /g' artifacts/redis_enterprise_active_active_database_api.md
sed -E -i 's/^<sup><sup>\[↩ Parent\]\(#redisenterpriseactiveactivedatabase/<sup><sup>\[↩ Parent\]\(#/g' artifacts/redis_enterprise_active_active_database_api.md
sed -E -i 's/<td><b><a href="#redisenterpriseactiveactivedatabase/<td><b><a href="#/' artifacts/redis_enterprise_active_active_database_api.md
crdoc --resources crds/rec_crd.yaml --output artifacts/redis_enterprise_cluster_api.md --template templates/template.tmpl
sed -E -i 's/^### RedisEnterpriseCluster\./### /g' artifacts/redis_enterprise_cluster_api.md
sed -E -i 's/^<sup><sup>\[↩ Parent\]\(#redisenterprisecluster/<sup><sup>\[↩ Parent\]\(#/g' artifacts/redis_enterprise_cluster_api.md
sed -E -i 's/<td><b><a href="#redisenterprisecluster/<td><b><a href="#/' artifacts/redis_enterprise_cluster_api.md
crdoc --resources crds/redb_crd.yaml --output artifacts/redis_enterprise_database_api.md --template templates/template.tmpl
sed -E -i 's/^### RedisEnterpriseDatabase\./### /g' artifacts/redis_enterprise_database_api.md
sed -E -i 's/^<sup><sup>\[↩ Parent\]\(#redisenterprisedatabase/<sup><sup>\[↩ Parent\]\(#/g' artifacts/redis_enterprise_database_api.md
sed -E -i 's/<td><b><a href="#redisenterprisedatabase/<td><b><a href="#/' artifacts/redis_enterprise_database_api.md
crdoc --resources crds/rerc_crd.yaml --output artifacts/redis_enterprise_remote_cluster.md --template templates/template.tmpl
sed -E -i 's/^### RedisEnterpriseRemoteCluster\./### /g' artifacts/redis_enterprise_remote_cluster.md
sed -E -i 's/^<sup><sup>\[↩ Parent\]\(#redisenterpriseremotecluster/<sup><sup>\[↩ Parent\]\(#/g' artifacts/redis_enterprise_remote_cluster.md
sed -E -i 's/<td><b><a href="#redisenterpriseremotecluster/<td><b><a href="#/' artifacts/redis_enterprise_remote_cluster.md
- name: 'Send pull request'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
RELEASE="${{ github.event.inputs.release }}"
BRANCH="k8s_apis_docs_${RELEASE}"
# Setup git email and username
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git config --global "url.https://${GH_TOKEN}@github.com/.insteadOf" https://github.com/
git checkout -b "${BRANCH}"
cp artifacts/redis_enterprise_active_active_database_api.md content/operate/kubernetes/reference/
cp artifacts/redis_enterprise_cluster_api.md content/operate/kubernetes/reference/
cp artifacts/redis_enterprise_database_api.md content/operate/kubernetes/reference/
cp artifacts/redis_enterprise_remote_cluster.md content/operate/kubernetes/reference/
git apply content/operate/kubernetes/reference/kubernetes-api-reference-frontmatter.patch
git add content/operate/kubernetes/reference/
git commit -m "k8s api docs ${RELEASE}"
git push origin "${BRANCH}"
gh pr create \
--body "k8s api docs ${RELEASE}" \
--title "k8s api docs ${RELEASE}" \
--head "$BRANCH" \
--base "main"