Skip to content

Commit

Permalink
publish
Browse files Browse the repository at this point in the history
  • Loading branch information
EnigmaCurry committed Mar 12, 2024
1 parent 21543a1 commit 5ca1915
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ MAKE_ := $(MAKE) -j1 --no-print-directory
LIB ?= emacs.d/init.el
SHELL := /bin/bash

PUBLISH_RCLONE_REMOTE ?= book_preview
PUBLISH_RCLONE_DIRECTORY ?= book_preview
PUBLISH_RCLONE_REMOTE ?= book
PUBLISH_RCLONE_DIRECTORY ?= book

RELEARN_THEME_SNAPSHOT ?= 974798afca08ff5f9768a0a7d575a71399ce7148
RELEARN_THEME_TARBALL_URL_PREFIX ?= https://codeload.github.com/McShelby/hugo-theme-relearn/tar.gz/
Expand Down
84 changes: 76 additions & 8 deletions books/publishing-with-org-mode.org
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@
This book describes how this site is written, in Org-mode, with
ox-hugo, and bits of Literate Programming.

* Introduction
:PROPERTIES:
:EXPORT_FILE_NAME: introduction
:END:

intro

* Dependencies
:PROPERTIES:
:EXPORT_FILE_NAME: dependencies
Expand All @@ -43,7 +36,23 @@ respective project pages. Please be aware that hugo has two editions:
(TODO: verify this - I had some problems before - but maybe they are
resolved - I am still using the extended edition for now).

You will also need to clone the source to your workstation:
Read the [[/linux-workstation/emacs-on-fedora/index.html][Linux Workstation chapter for setting up Emacs]].

Please note that your package manager may container an old version of
Hugo that is incompatible with the Relearn theme. You can install the
/latest/ version of Hugo from the [[https://github.com/gohugoio/hugo/releases][Hugo GitHub releases page]].

For example, to download the X86_64 release of hugo =v0.123.8=:

: # Do this if your package manager installs an old incompatible version of Hugo:
:
: cd ~/Downloads
: wget https://github.com/gohugoio/hugo/releases/download/v0.123.8/hugo_extended_0.123.8_linux-amd64.tar.gz
: tar xfvz hugo_extended_0.123.8_linux-amd64.tar.gz
: sudo install hugo /usr/local/bin/hugo

You will also need to clone the git source of this website to your
workstation:

: git clone https://github.com/EnigmaCurry/org.git
: ~/git/vendor/enigmacurry/org
Expand Down Expand Up @@ -82,3 +91,62 @@ Run the development server:

: # This builds the entire site, and then runs the live reload server:
: make serve

* Publishing with GitHub pages
:PROPERTIES:
:EXPORT_FILE_NAME: publish-with-github-pages
:END:

This site is automatically published to [[https://pages.github.com][GitHub Pages]] via the included
action file: [[https://github.com/EnigmaCurry/org/blob/ox-hugo/.github/workflows/deploy.yaml][.github/workflows/deploy.yaml]]. You can fork the
repository and enable the action to run on your behalf and publish to
your own site automatically, whenever you run =git push=.

* Publishing to any webserver with SFTP
:PROPERTIES:
:ORDERED: t
:END:

If you don't want to use GitHub pages, you can alternatively publish
to any webserver via SFTP.

To do so, you must install [[https://rclone.org/][Rclone]].

For example, on Fedora:

: # On Fedora atomic, make sure to do this in a toolbox container:
: sudo dnf install rclone

Once installed, you need to configure the remote SFTP server you want to publish to:

: rclone config

Follow the prompts to setup your SFTP remote, or you can see the
[[https://rclone.org/sftp/][example SFTP documentation]] for doing this. You must set all of the
following details:

* The unique name of the remote (eg. =book=)
* The hostname of the SFTP server (eg. =sftp.example.com=)
* The SFTP username, password, or SSH key, and whether to use the SSH
agent (recommended!)

The connection details are saved in your clone config file (eg.
=~/.config/rclone/rclone.conf=)

The included [[https://github.com/EnigmaCurry/org/blob/ox-hugo/Makefile][Makefile]] has a variable at the top called
=PUBLISH_RCLONE_REMOTE= (default =book=). Make sure this is the same
as the name of the rclone remote you configured (edit the Makefile if
it is not).

Once everything is configured, simply run =make publish= to publish
your site to the SFTP remote.

Your webserver document root needs to be configured to use the same
path that the SFTP server is configured for.

If you don't have a webserver or SFTP server, you can use the
following from d.rymcg.tech:

* [[https://github.com/EnigmaCurry/d.rymcg.tech/tree/master/sftp#readme][SFTP server]]
* [[https://github.com/EnigmaCurry/d.rymcg.tech/tree/master/nginx#readme][Nginx webserver]]

0 comments on commit 5ca1915

Please sign in to comment.