minor: move deployment instructions into a ./deploy.sh
Note: this also changes the remote to use SSH, since its seems all (3)
users aren't using https anyways.
The script is mainly copy-paste except that it handles
* when there's a pre-existing checkout of the tree
* running from a subdir of the kunit-website tree
* an option to not commit and push
* this helps if you want to check the files manually or have some
unique setup wrt push credentials
Change-Id: I4224850c5da70fbd01d7ae4104044b6695df33f2
Signed-off-by: Daniel Latypov <dlatypov@google.com>
diff --git a/README.md b/README.md
index 5a38ca5..ca13144 100644
--- a/README.md
+++ b/README.md
@@ -41,11 +41,11 @@
and then:
```bash
-git clone https://github.com/google/kunit-docs.git
-cd kunit-docs/
-git ls-files -z | xargs -0 rm -f
-cp -r ../kunit-website/_build/html/. ./
-git add -A
-git commit
-git push -u origin
+./deploy.sh
+```
+
+You can copy the files over without committing and pushing the files with:
+
+```bash
+./deploy.sh --no-commit
```
diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..c182c3d
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -ex
+
+for arg in "$@"; do
+ case "${arg}" in
+ --no-commit)
+ no_commit="true"
+ ;;
+ *)
+ >&2 echo "Unrecognized option: ${arg}"
+ exit 2
+ esac
+done
+
+echo "Going to setup a kunit-docs/ repo adjacent to this one"
+
+# Get to the root of the repo
+cd $(git rev-parse --show-toplevel)
+cd ..
+
+
+if [[ ! -d kunit-docs/ ]]; then
+ git clone git@github.com:google/kunit-docs.git
+ cd kunit-docs/
+else # re-use the existing one but force it to be up to date
+ cd kunit-docs/
+ git fetch
+ git checkout origin/master
+fi
+
+git ls-files -z | xargs -0 rm -f
+cp -r ../kunit-website/_build/html/. ./
+
+[[ -n $no_commit ]] && exit 0
+git add -A
+git commit
+git push git@github.com:google/kunit-docs.git