summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2023-03-08 09:47:16 +0100
committerPatrick Spek <p.spek@tyil.nl>2023-03-08 09:47:16 +0100
commit256203f82407942d0e33b51905ec81cf43262a1d (patch)
treed1413262bef0595531b994a6d3579253e9822669
Initial commit
-rw-r--r--description.txt1
-rw-r--r--playbook.bash33
2 files changed, 34 insertions, 0 deletions
diff --git a/description.txt b/description.txt
new file mode 100644
index 0000000..c43df4c
--- /dev/null
+++ b/description.txt
@@ -0,0 +1 @@
+Sources for my personal blog
diff --git a/playbook.bash b/playbook.bash
new file mode 100644
index 0000000..e2c0617
--- /dev/null
+++ b/playbook.bash
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+playbook_add() {
+ local path
+
+ path="$(config "$BASHTARD_PLAYBOOK.path" "/var/www/$BASHTARD_PLAYBOOK")"
+
+ mkdir -p -- "$path"
+ git -C "$path" init
+ git -C "$path" remote add "$(config "$BASHTARD_PLAYBOOK.remote" "origin")" "$(config "$BASHTARD_PLAYBOOK.repository")"
+
+ playbook_sync
+}
+
+playbook_sync() {
+ local branch
+ local path
+ local remote
+
+ branch="$(config "$BASHTARD_PLAYBOOK.branch" "master")"
+ path="$(config "$BASHTARD_PLAYBOOK.path" "/var/www/$BASHTARD_PLAYBOOK")"
+ remote="$(config "$BASHTARD_PLAYBOOK.remote" "origin")"
+
+ git -C "$path" fetch "$remote" "$branch"
+ git -C "$path" reset --hard "$remote/$branch"
+
+ hugo -D # This will generate all the draft content
+ hugo # And this will generate the actual live blog, but won't remove the draft content
+}
+
+playbook_del() {
+ rm -fr -- "$(config "$BASHTARD_PLAYBOOK.path" "/var/www/$BASHTARD_PLAYBOOK")"
+}