Update docs release script
Update script for copying generated docs from kubernetes/kubernetes into kubernetes/kubernetes.github.io Make it actually do what is necessary for a new docs release
This commit is contained in:
parent
adfe244f9e
commit
f08f979e43
|
|
@ -1,6 +1,8 @@
|
||||||
overrides:
|
overrides:
|
||||||
- path: docs/api-reference
|
- path: docs/api-reference
|
||||||
- path: docs/user-guide/kubectl
|
- path: docs/user-guide/kubectl
|
||||||
|
- path: docs/admin/federation-apiserver.md
|
||||||
|
- path: docs/admin/federation-controller-manager.md
|
||||||
- path: docs/admin/kube-apiserver.md
|
- path: docs/admin/kube-apiserver.md
|
||||||
- path: docs/admin/kube-controller-manager.md
|
- path: docs/admin/kube-controller-manager.md
|
||||||
- path: docs/admin/kube-proxy.md
|
- path: docs/admin/kube-proxy.md
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,38 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -x
|
# Uncomment this to see the commands as they are run
|
||||||
|
# set -x
|
||||||
|
|
||||||
VERSION=1.3
|
VERSION=1.3
|
||||||
|
|
||||||
git clone --depth=1 https://github.com/kubernetes/kubernetes.git k8s
|
#git clone --depth=1 -b release-$VERSION https://github.com/kubernetes/kubernetes.git k8s
|
||||||
cd k8s
|
cd k8s
|
||||||
git remote add upstream https://github.com/kubernetes/kubernetes.git
|
#git remote add upstream https://github.com/kubernetes/kubernetes.git
|
||||||
git fetch upstream
|
#git fetch upstream
|
||||||
git checkout release-$VERSION
|
#hack/generate-docs.sh
|
||||||
hack/generate-docs.sh
|
#hack/update-generated-swagger-docs.sh
|
||||||
hack/update-generated-swagger-docs.sh
|
#build/versionize-docs.sh release-$VERSION
|
||||||
build/versionize-docs.sh release-$VERSION
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
|
||||||
rm -rf _includes/v$VERSION
|
rm -rf _includes/v$VERSION
|
||||||
mkdir _includes/v$VERSION
|
mkdir _includes/v$VERSION
|
||||||
|
|
||||||
# batch fetches
|
# batch fetches
|
||||||
while read line || [[ -n ${line} ]]; do
|
while read line || [[ -n ${line} ]]; do
|
||||||
IFS=': ' read -a myarray <<< "${line}"
|
IFS=': ' read -a myarray <<< "${line}"
|
||||||
#echo "arraypos0: ${myarray[0]}"
|
if [ "${myarray[1]}" = "path" ]; then
|
||||||
#echo "arraypos1: ${myarray[1]}"
|
|
||||||
#echo "arraypos2: ${myarray[2]}"
|
|
||||||
#echo "arraypos3: ${myarray[3]}"
|
|
||||||
if [ "${myarray[1]}" = "path" ]; then
|
|
||||||
TARGET="${myarray[2]}"
|
TARGET="${myarray[2]}"
|
||||||
CLEARPATH="${TARGET}"
|
CLEARPATH="${TARGET}"
|
||||||
K8SSOURCE='k8s/'${TARGET}
|
K8SSOURCE='k8s/'${TARGET}
|
||||||
DESTINATION=${TARGET%/*}
|
DESTINATION=${TARGET%/*}
|
||||||
rm -rf "${CLEARPATH}"
|
rm -rf "${CLEARPATH}"
|
||||||
mv -f "${K8SSOURCE}" "${DESTINATION}"
|
yes | cp -rf "${K8SSOURCE}" "${DESTINATION}"
|
||||||
# find "${DESTINATION}" -name "*${DESTINATION}" -print0 | xargs -0 sed -i '' -e 's/.html)/)/g'
|
fi
|
||||||
fi
|
|
||||||
if [ "${myarray[1]}" = "changedpath" ]; then
|
if [ "${myarray[1]}" = "changedpath" ]; then
|
||||||
SRC="${myarray[2]}"
|
SRC="${myarray[2]}"
|
||||||
DESTINATION="${myarray[3]}"
|
DESTINATION="${myarray[3]}"
|
||||||
echo "mv -f ${SRC} ${DESTINATION}"
|
echo "mv -f ${SRC} ${DESTINATION}"
|
||||||
mv -f "${SRC}" "${DESTINATION}"
|
yes | cp -rf "${SRC}" "${DESTINATION}"
|
||||||
fi
|
fi
|
||||||
if [ "${myarray[1]}" = "copypath" ]; then
|
if [ "${myarray[1]}" = "copypath" ]; then
|
||||||
K8SSOURCE="${myarray[2]}"
|
K8SSOURCE="${myarray[2]}"
|
||||||
|
|
@ -49,12 +43,68 @@ while read line || [[ -n ${line} ]]; do
|
||||||
done <_data/overrides.yml
|
done <_data/overrides.yml
|
||||||
|
|
||||||
# refdoc munging
|
# refdoc munging
|
||||||
|
pushd .
|
||||||
cd _includes/v$VERSION
|
cd _includes/v$VERSION
|
||||||
find . -name '*.html' -type f -exec sed -i -e '/<style>/,/<\/style>/d' {} \;
|
# These are included in other files, so strip the DOCTYPE
|
||||||
find . -name '*.html' -type f -exec sed -i -e "s/http:\/\/kubernetes.io\/v$VERSION//g" {} \;
|
find . -name '*.html' -type f -exec sed -i -e "s/<!DOCTYPE html>//g" {} \;
|
||||||
cd ..
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
rm -rf k8s
|
# Format html
|
||||||
|
find . -name '*.html' -type f -exec sed -i -e '/<style>/,/<\/style>/d' {} \;
|
||||||
|
find . -name '*.html' -type f -exec sed -i -e "s/http:\/\/kubernetes.io\/v$VERSION//g" {} \;
|
||||||
|
popd
|
||||||
|
|
||||||
echo "Docs imported! Run 'git add .' 'git commit -m <comment>' and 'git push' to upload them"
|
pushd .
|
||||||
|
cd docs/api-reference
|
||||||
|
# Format html
|
||||||
|
find . -name '*.html' -type f -exec sed -i -e '/<style>/,/<\/style>/d' {} \;
|
||||||
|
find . -name '*.html' -type f -exec sed -i -e "s/http:\/\/kubernetes.io\/v$VERSION//g" {} \;
|
||||||
|
find . -name '*.html' -type f -exec sed -i -e '1 i\
|
||||||
|
---' {} \;
|
||||||
|
find . -name '*.html' -type f -exec sed -i -e '1 i\
|
||||||
|
---' {} \;
|
||||||
|
|
||||||
|
# Strip the munge comments
|
||||||
|
find . -name '*.md' -type f -exec sed -i -e '/<!-- BEGIN MUNGE: IS_VERSIONED -->/,/<!-- END MUNGE: IS_VERSIONED -->/d' {} \;
|
||||||
|
find . -name '*.md' -type f -exec sed -i -e '/<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->/,/<!-- END MUNGE: UNVERSIONED_WARNING -->/d' {} \;
|
||||||
|
|
||||||
|
# Add the expected headers to md files
|
||||||
|
find . -name '*.md' -type f -exec sed -i -e '1 i\
|
||||||
|
---' {} \;
|
||||||
|
find . -name '*.md' -type f -exec sed -i -e '1 i\
|
||||||
|
---' {} \;
|
||||||
|
|
||||||
|
# Fix for bug in 1.3 release
|
||||||
|
find . -name '*.md' -type f -exec sed -i -e "s/vv1.3.0-beta.0/v1.3/g" {} \;
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd .
|
||||||
|
cd docs/user-guide/kubectl
|
||||||
|
# Strip the munge comments
|
||||||
|
find . -name '*.md' -type f -exec sed -i -e '/<!-- BEGIN MUNGE: IS_VERSIONED -->/,/<!-- END MUNGE: IS_VERSIONED -->/d' {} \;
|
||||||
|
find . -name '*.md' -type f -exec sed -i -e '/<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->/,/<!-- END MUNGE: UNVERSIONED_WARNING -->/d' {} \;
|
||||||
|
|
||||||
|
# Add the expected headers to md files
|
||||||
|
find . -name '*.md' -type f -exec sed -i -e '1 i\
|
||||||
|
---' {} \;
|
||||||
|
find . -name '*.md' -type f -exec sed -i -e '1 i\
|
||||||
|
---' {} \;
|
||||||
|
popd
|
||||||
|
|
||||||
|
|
||||||
|
BINARIES="federation-apiserver.md federation-controller-manager.md kube-apiserver.md kube-controller-manager.md kube-proxy.md kube-scheduler.md kubelet.md"
|
||||||
|
|
||||||
|
pushd .
|
||||||
|
cd docs/admin
|
||||||
|
for bin in $BINARIES; do
|
||||||
|
sed -i -e '/<!-- BEGIN MUNGE: IS_VERSIONED -->/,/<!-- END MUNGE: IS_VERSIONED -->/d' $bin
|
||||||
|
sed -i -e '/<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->/,/<!-- END MUNGE: UNVERSIONED_WARNING -->/d' $bin
|
||||||
|
sed -i -e '1 i\
|
||||||
|
---' $bin
|
||||||
|
sed -i -e '1 i\
|
||||||
|
---' $bin
|
||||||
|
done
|
||||||
|
popd
|
||||||
|
|
||||||
|
#rm -rf k8s
|
||||||
|
|
||||||
|
echo "Docs imported! Run 'git add .' 'git commit -m <comment>' and 'git push' to upload them"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue