]> git.ekhem.eu.org Git - metadata.git/commitdiff
[cv] Configure automatic deployment and describe the repository.
authorJakub Czajka <jakub@ekhem.eu.org>
Mon, 19 Jun 2023 15:50:16 +0000 (17:50 +0200)
committerJakub Czajka <jczajka@google.com>
Sun, 24 Dec 2023 18:45:06 +0000 (19:45 +0100)
cv.git/deploy.yaml [new file with mode: 0644]
cv.git/description [new file with mode: 0644]
cv.git/hooks/post-receive [new file with mode: 0755]

diff --git a/cv.git/deploy.yaml b/cv.git/deploy.yaml
new file mode 100644 (file)
index 0000000..0cb6ebb
--- /dev/null
@@ -0,0 +1,29 @@
+# Copyright (c) 2023 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+
+- hosts: servers
+  vars:
+    dest: "{{ ansible_local.env.vars.prod_dir }}/cv"
+    repo: "{{ ansible_local.env.vars.git_home_dir }}/cv.git"
+  tasks:
+    - name: Install texlive
+      package:
+        name:
+          - texlive
+        state: latest
+      become: true
+    - name: Create destination directory
+      file:
+        path: "{{ dest }}"
+        state: directory
+        mode: 0775
+        owner: git
+        group: git
+      become: true
+    - name: Checkout cv's files to the destination directory
+      command: /usr/bin/git --work-tree={{ dest }} --git-dir={{ repo }} \
+        checkout main --force
+      become: true
+    - name: Compile CV
+      command: /usr/bin/pdflatex --output-directory={{ dest }} {{ dest }}/cv.tex
+      become: true
diff --git a/cv.git/description b/cv.git/description
new file mode 100644 (file)
index 0000000..813371c
--- /dev/null
@@ -0,0 +1 @@
+Files for generating Curriculum Vitae (CV).
diff --git a/cv.git/hooks/post-receive b/cv.git/hooks/post-receive
new file mode 100755 (executable)
index 0000000..ac81bdc
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Copyright (c) 2023 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+
+while read old_revision new_revision branch
+do
+    if [ "${branch}" != "refs/heads/main" ]
+    then
+       echo "${branch} is not the main branch so not deploying."
+       exit 0
+    fi
+    sudo /usr/bin/ansible-playbook --connection=local deploy.yaml
+done