Automatic update of the website

This commit is contained in:
Thomas Dehaeze 2020-11-03 11:31:37 +01:00
parent 99beff129d
commit f47592cafd

View File

@ -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