mkdocs update
authorNiki Roo <niki@nikiroo.be>
Wed, 3 Jul 2024 12:55:56 +0000 (14:55 +0200)
committerNiki Roo <niki@nikiroo.be>
Wed, 3 Jul 2024 12:55:56 +0000 (14:55 +0200)
.gitmodules [new file with mode: 0644]
mkdocs/site [new submodule]
mkdocs/update.sh

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..35b640b
--- /dev/null
@@ -0,0 +1,4 @@
+[submodule "mkdocs/site"]
+       path = mkdocs/site
+       url = git@git.nikiroo.be:workspace/notes.git
+       branch = html
diff --git a/mkdocs/site b/mkdocs/site
new file mode 160000 (submodule)
index 0000000..222a230
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 222a2306973db10bc76ff67f16fb1f6a44832a1f
index 433dd43bd812671668086e3cc69d91e10b63d978..a28c1e6368ae59006693e286bcf7937700bf4e8c 100755 (executable)
@@ -1,10 +1,10 @@
 #!/bin/sh
 
-cd "`dirname "$0"`" || exit 42
 DDIR=/home/user/Notes
 
 if [ "$1" = "" ]; then
        # Host
+       cd "`dirname "$0"`" || exit 42
        cd ..
        rm -f mkdocs/ok
        touch mkdocs/wip
@@ -17,9 +17,24 @@ if [ "$1" = "" ]; then
        [ -e mkdocs/ok ] ; rep=$? ; rm -f mkdocs/ok
        if [ $rep = 0 ]; then
                echo Copying to remote site...
-               echo TODO
+               cd mkdocs/site
+               git add .
+               if [ $? != 0 ]; then
+                       echo Failure to add newly built html site >&2
+                       exit 20
+               fi
+               git commit -m "`date +"Auto commit %Y-%m-%d %H:%M"`"
+               if [ $? != 0 ]; then
+                       echo Failure to commit to git >&2
+                       exit 21
+               fi
+               git push nikiroo html
+               if [ $? != 0 ]; then
+                       echo Failure to push html branch to nikiroo >&2
+                       exit 22
+               fi
        else
-               echo Failed to update, no remote copy started: $rep
+               echo Failed to update, no remote copy started: $rep >&2
        fi
        rm -f mkdocs/wip
        exit $rep