[Export, Drone] Update export.el and .drone.yml

export.el:
Now export all org files in specified directories
Code a bit cleaner

.drone.yml:
Send all the content of org/config to the remote server
This commit is contained in:
Lucien Cartier-Tilet 2021-11-22 17:17:06 +01:00
parent d776dae8fb
commit a04de69b10
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
2 changed files with 21 additions and 14 deletions

View File

@ -22,8 +22,7 @@ steps:
target: target:
from_secret: ssh_target from_secret: ssh_target
source: source:
- !org/config/LICENSE.md - org/config/*
- org/config/*.html
strip_components: 2 strip_components: 2
username: username:
from_secret: ssh_username from_secret: ssh_username

View File

@ -1,22 +1,30 @@
#!/usr/bin/env -S emacs -Q --script #!/usr/bin/env -S emacs -Q --script
(require 'package) (require 'package)
(require 'org) (require 'org)
(require 'ox-html) (require 'ox-html)
(setq package-archives '(("melpa" . "https://melpa.org/packages/"))) (setq package-archives '(("melpa" . "https://melpa.org/packages/")))
(package-initialize) (package-initialize)
(package-refresh-contents) (package-refresh-contents)
(package-install 'htmlize) (package-install 'htmlize)
(setq org-confirm-babel-evaluate nil (setq org-confirm-babel-evaluate nil
org-html-validation-link nil) org-html-validation-link nil)
(let ((files (mapcar #'expand-file-name
(file-expand-wildcards "org/config/*.org")))) (defun export-and-clean (directory)
(mapc (lambda (file) (progn (mapc (lambda (file)
(message (format "==========\nExporting %S\n==========" file)) (progn (message (concat "====================\n"
"Exporting "
file
"\n"
"====================\n"))
(with-current-buffer (find-file file) (with-current-buffer (find-file file)
(org-html-export-to-html))) (org-html-export-to-html))))
files)) (directory-files directory t (regexp-quote ".org")))
(let* ((files (mapcar #'expand-file-name
(file-expand-wildcards "org/config/*.html~"))))
(mapc (lambda (file) (mapc (lambda (file)
(delete-file file)) (delete-file file nil))
files)) (directory-files directory t (regexp-quote "html~")))))
(dolist (dir '("org/config/" "org/config/Deprecated/" "org/config/WIP"))
(export-and-clean dir))