[CI] Add CI script, add export script

Drone script calls new `export.el' script written in Emacs Lisp to
export all org files to HTML files.

HTML files should then be uploaded to a remote server with SCP
This commit is contained in:
Lucien Cartier-Tilet 2020-09-03 10:44:27 +02:00
parent d34d4b0550
commit a81b314a9e
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
2 changed files with 56 additions and 0 deletions

35
.drone.yml Normal file
View File

@ -0,0 +1,35 @@
kind: pipeline
name: default
steps:
- name: build
image: silex/emacs:27
commands:
- pwd
- ls -ahl
- which emacs
- emacs --script export.el
- name: deploy
image: appleboy/drone-scp
settings:
host:
from_secret: ssh_host
target:
from_secret: ssh_target
source:
- !org/config/LICENSE.md
- org/config/*.html
strip_components: 2
username:
from_secret: ssh_username
password:
from_secret: ssh_password
port:
from_secret: ssh_port
# when:
# branch:
# - master
# event:
# exclude:
# - pull_request

21
export.el Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/emacs --script
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(package-refresh-contents)
(package-install 'htmlize)
(package-install 's)
(require 's)
(setq org-confirm-babel-evaluate nil)
(let* ((files (mapcar #'expand-file-name
(file-expand-wildcards "org/config/*.org"))))
(mapc (lambda (file)
(message (format "==========\nExporting %S\n==========" file))
(with-current-buffer (find-file file)
(org-html-export-to-html)))
files))
(let* ((files (mapcar #'expand-file-name
(file-expand-wildcards "org/config/*.html~"))))
(mapc (lambda (file)
(delete-file file))
files))