From 7cacb1c07b449724b1dc8ba549695b51b1b4a20f Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Tue, 3 Nov 2020 11:31:37 +0100 Subject: [PATCH] Automatic update of the website --- dotfiles/systemd.org | 60 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/dotfiles/systemd.org b/dotfiles/systemd.org index 3cc69b6..57e75f7 100644 --- a/dotfiles/systemd.org +++ b/dotfiles/systemd.org @@ -390,3 +390,63 @@ https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage- [Install] WantedBy=multi-user.target #+end_src + +* Brain Website +** Service +:PROPERTIES: +:header-args: :tangle ~/.config/systemd/user/braingit.service +:header-args+: :comments both :mkdirp yes +:END: + +#+BEGIN_SRC conf + [Unit] + Description=Sync Brain Website everyday + RefuseManualStart=no + RefuseManualStop=yes + + [Service] + Type=oneshot + ExecStart=%h/.local/bin/brain_git_push +#+END_SRC + +** Timer +:PROPERTIES: +:header-args: :tangle ~/.config/systemd/user/braingit.timer +:header-args+: :comments both :mkdirp yes +:END: + +#+BEGIN_SRC conf + [Unit] + Description=Sync Brain Website everyday + RefuseManualStart=no + RefuseManualStop=no + Wants=network-online.target + After=network-online.target + + [Timer] + OnCalendar=*-*-* 16:00:00 + Persistent=true + Unit=braingit.service + + [Install] + WantedBy=default.target +#+END_SRC + +** Script +:PROPERTIES: +:header-args: :tangle ~/.local/bin/brain_git_push +:header-args+: :comments both :mkdirp yes +:header-args+: :shebang "#!/usr/bin/env bash" +:END: + +#+begin_src bash + cd ~/Cloud/brain-website/ + + if [[ ! -z $(git status -s content/) ]] + then + git add content static && \ + git commit -m "Update Content - $(date +%F)" && \ + git push + exit + fi +#+end_src