diff --git a/.drone.yml b/.drone.yml index ee7db3e..7db782d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -4,35 +4,66 @@ type: docker name: CD steps: -- name: restore cache +- name: restore cache node image: drillster/drone-volume-cache volumes: - - name: cache - path: /cache + - name: main-website-node + path: /cache/phundrak.com/node settings: restore: true mount: - ./node_modules -- name: generate +- name: restore cache emacs + image: drillster/drone-volume-cache + volumes: + - name: main-website-emacs + path: /cache/phundrak.com/emacs + settings: + restore: true + mount: + - /root/.emacs.d + +- name: generate emacs + image: silex/emacs:master-alpine + commands: + - apk update && apk add git + - emacs -Q --script export.el + depends_on: + - "restore cache emacs" + +- name: generate node image: node:19-alpine commands: - yarn install - yarn build depends_on: - - "restore cache" + - "restore cache node" + - "generate emacs" -- name: rebuild cache +- name: rebuild cache emacs image: drillster/drone-volume-cache volumes: - - name: cache - path: /cache + - name: conlang-emacs + path: /cache/conlang/emacs + settings: + rebuild: true + mount: + - /root/.emacs.d + depends_on: + - "generate emacs" + +- name: rebuild cache node + image: drillster/drone-volume-cache + volumes: + - name: main-website-node + path: /cache/phundrak.com/node settings: rebuild: true mount: - ./node_modules depends_on: - - generate + - "generate node" - name: deploy stable image: appleboy/drone-scp @@ -50,7 +81,7 @@ steps: port: from_secret: ssh_port depends_on: - - generate + - "generate node" when: branch: - main @@ -93,7 +124,7 @@ steps: port: from_secret: ssh_port depends_on: - - generate + - "generate node" when: branch: - devel diff --git a/export.el b/export.el new file mode 100644 index 0000000..51d376b --- /dev/null +++ b/export.el @@ -0,0 +1,29 @@ +(require 'package) +(require 'org) +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) +(package-initialize) +(package-refresh-contents) +(package-install 'f) +(package-install 'ox-gfm) + +(require 'f) +(require 'ox-gfm) +(require 'ox-publish) + +(setq org-confirm-babel-evaluate nil + org-html-validation-link nil + make-backup-files nil + org-export-with-broken-links t) + +(defvar project-root + (file-name-as-directory (expand-file-name "content" default-directory))) + +(message "Emacs directory: %s" (f-full user-emacs-directory)) + +(dolist (file (f-files project-root (lambda (file) (f-ext-p file "org")) t)) + (message "====== Exporting %s" (f-relative file)) + (with-temp-buffer + (find-file file) + (org-export-to-file 'gfm (concat (f-no-ext file) ".md")))) + +(message "Project generated!")