k8s_apis_sync #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |