diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml new file mode 100644 index 0000000..8d544ba --- /dev/null +++ b/.forgejo/workflows/deploy.yaml @@ -0,0 +1,23 @@ +name: Deploy + +on: + push: + branches: [main] + +jobs: + publish: + runs-on: host + steps: + + - name: Setup PATH + run: | + echo "/nix/var/nix/profiles/default/bin" >> $GITHUB_PATH + echo "/var/lib/forgejo-runner/.nix-profile/bin" >> $GITHUB_PATH + + - name: checkout + run: | + git clone --quiet --depth=1 $GITHUB_SERVER_URL/roland/org-howto.git . + + - name: publish + run: | + nix-shell shell.nix --run "./bin/howto-publish /var/www/org-howto" diff --git a/bin/howto-publish b/bin/howto-publish new file mode 100755 index 0000000..b49c5fa --- /dev/null +++ b/bin/howto-publish @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -euo pipefail + +src_dir="$(cd "$(dirname "$0")/.." && pwd)" +dest_dir="${1:?usage: howto-publish DEST_DIR}" + +mkdir -p "${dest_dir}" + +emacs --batch \ + --eval "(require 'ox-publish)" \ + --eval "(setq org-publish-project-alist + '((\"org-howto\" + :components (\"org-howto-notes\" \"org-howto-static\")) + (\"org-howto-notes\" + :base-directory \"${src_dir}\" + :base-extension \"org\" + :publishing-directory \"${dest_dir}\" + :recursive t + :publishing-function org-html-publish-to-html + :auto-preamble t) + (\"org-howto-static\" + :base-directory \"${src_dir}\" + :base-extension \"css|html|js|svg|ico|png|jpg|gif|pdf\" + :publishing-directory \"${dest_dir}\" + :recursive t + :publishing-function org-publish-attachment)))" \ + --eval "(org-publish \"org-howto\" t)" diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..772389b --- /dev/null +++ b/shell.nix @@ -0,0 +1,10 @@ +{ pkgs ? import {} }: + +let + emacs = (pkgs.emacsPackagesFor pkgs.emacs30).emacsWithPackages (ep: [ + ep.htmlize + ]); +in +pkgs.mkShell { + buildInputs = [ emacs ]; +}