From a81b314a9ed0ed07947c079547c9142087ce2693 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Thu, 3 Sep 2020 10:44:27 +0200 Subject: [PATCH] [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 --- .drone.yml | 35 +++++++++++++++++++++++++++++++++++ export.el | 21 +++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .drone.yml create mode 100755 export.el diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..e218521 --- /dev/null +++ b/.drone.yml @@ -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 diff --git a/export.el b/export.el new file mode 100755 index 0000000..2df70fa --- /dev/null +++ b/export.el @@ -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))