diff --git a/.gitignore b/.gitignore index abc19eb065..7cd27d2e1c 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ docs.helm.sh/ # JetBrains IDEs (GoLand, IntelliJ, ...) config folder .idea + +scripts/update-docs/.tmp.docs diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..5286ef6b2b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "helm"] + path = scripts/update-docs/helm + url = https://github.com/helm/helm diff --git a/README.md b/README.md index e7bb94b113..7da2b6de2d 100755 --- a/README.md +++ b/README.md @@ -43,14 +43,7 @@ For earlier versions, see the dev-v2 branch of the main Helm repo [here](https:/ The documentation for the list of Helm CLI Commands are [exported](https://github.com/helm/helm/blob/a6b2c9e2126753f6f94df231e89b2153c2862764/cmd/helm/root.go#L169) from the main helm project repo and rendered [here on the website](https://helm.sh/docs/helm) as a reference. -To update these docs, you'll need to: - -1. Go to the `helm/helm` repo and fetch the latest master. -2. Run `helm docs --type markdown` to generate the markdown docs files -3. Copy the generated files (helm.md, helm_create.md, etc) -4. Return to the `helm/helm-www` repo and navigate to `content/en/docs/helm/` -5. Paste the latest CLI command docs here, replacing any prior markdown files -6. Commit the changes and create a PR to update the website. +To update these docs simply run `yarn update-docs`. ### How to Write a Blog Post diff --git a/package.json b/package.json index 1bf497bb12..dcd696f621 100755 --- a/package.json +++ b/package.json @@ -18,5 +18,8 @@ "last 2 versions", "Firefox ESR", "not dead" - ] + ], + "scripts": { + "update-docs": "./scripts/update-docs/update-docs.sh" + } } diff --git a/scripts/update-docs/helm b/scripts/update-docs/helm new file mode 160000 index 0000000000..7ce29e12fa --- /dev/null +++ b/scripts/update-docs/helm @@ -0,0 +1 @@ +Subproject commit 7ce29e12fa8ac7195613ffa1a76b2914150ff756 diff --git a/scripts/update-docs/update-docs.sh b/scripts/update-docs/update-docs.sh new file mode 100755 index 0000000000..36ad904f41 --- /dev/null +++ b/scripts/update-docs/update-docs.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Abort if anything messes up, namely to avoid `git reset --hard` in our working repo +# or `rsync --delete`ing valid doc templates +set -e + +# Init submodules +git submodule update --init --recursive + +pushd scripts/update-docs/ + +# Ensure we've created our temp doc directory, but don't fail if we have already +mkdir .tmp.docs || : + +# Make sure the submodule is pointing at master; note this may introduce pending changes +pushd helm +git fetch +git reset --hard origin/master +helm docs --type=markdown --dir ../.tmp.docs +popd +rsync --recursive --delete ./.tmp.docs/ ../../content/en/docs/helm/ +popd + +echo Docs updated. \ No newline at end of file