emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Matt Price <moptop99@gmail.com>
Cc: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: run shell command after publishing project
Date: Fri, 08 Dec 2017 22:19:33 +0000	[thread overview]
Message-ID: <CAFyQvY0TcZ5VwcJzjXVVNQLvqG3inVw6GB=WKXDp2vppKSY8Mg@mail.gmail.com> (raw)
In-Reply-To: <CAN_Dec8PGRZHULMxgM1UsEQNZP9xxzUaR+gra7RtaGygY2Q8-w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4497 bytes --]

On Fri, Dec 8, 2017 at 4:38 PM Matt Price <moptop99@gmail.com> wrote:

> This sounds fantastic, Kaushal. I'm struggling to follow, so wl lask some
> questions inline.
>

Sure, my answers are below.

- the doc/ directory contains the full Hugo source directory, with
> config.toml, content/, layouts, etc., as well as the theme, which looks
> like it's statically installed
>

Correct.


> - looks like maybe the hugo html ends up in public, but then it gets moved
> somehow (can't quite figure out how)
>

Travis CI deals with that. You can look at the use-package Travis setup
here[1]. The revelant portion for the site deployment is:

=====
before_deploy: cd doc && make doc
deploy:
  provider: pages
  skip_cleanup: true
  github_token: $GITHUB_TOKEN
  local_dir: public
  on:
    branch: master
    condition: $EMACS_VERSION = 26
=====

(I use emacs 26 specifically to build the site as it comes with Org 9.1.4..
so then I don't need to install Org on the Travis CI machine.)


> - the ox-hugo files are kept somewhere I guess
>

No. The latest ox-hugo version available on Melpa is used. That is done via
the same Makefile.. it loads a setup file I have: setup-ox-hugo.el[2].


> - presumably any personal config has to be replicated somewhere on the web
> where travis can access it
>

The same setup-ox-hugo.el has some minimal "sane settings" (Look at the
"(with-eval-after-load 'org" in there for example). You can also add your
personal setup to that as needed.


> - is there any more setup that needs to be done on Travis?
>

1. The .travis.yml file mentioned above.
2. Get your GITHUB_TOKEN (minimum permission level: public_repo) to assign
to Travis[3].
3. Set the GITHUB_TOKEN and HUGO_BASE_URL env variables in the Travis
settings for your repo on https://travis-ci.org/USER/REPO/settings.

- I have 4 main org files; 3 of them get copied per-header, and one as a
> whole file.  Is that an issue?
>

No. The latest ox-hugo version now has org-hugo-export-wim-to-md. "wim"
stands for What I Mean. See https://ox-hugo.scripter.co/#export-bindings or
the comment header in ox-hugo.el for details.

In setup-ox-hugo.el, I define this simple wrapper function:

(defun org-hugo-export-all-wim-to-md ()
  (org-hugo-export-wim-to-md :all-subtrees nil nil :noerror))

In the Makefile, that function is used in the "md1" rule.
And that rule is called in loop by the "md" rule:

md: $(org_files)
$(org_files):
    @$(MAKE) md1 ORG_FILE=$@ TIMEZONE=UTC # Use UTC/Universal time zone for
tests

So you only need to tweak the "org_files" rule which is a simple find
command to collect an array of all the Org files you want to export
(doesn't matter if they are file-based or subtree-based).

If there's any subtree that you don't want to export or any file that you
don't want to export in this process, tag the subtree with "foo" tag
(example) and the file with #+FILETAGS keyword set to "foo", and add the
same "foo" tag to org-export-exclude-tags in the setup-ox-hugo.el. More
info:
https://ox-hugo.scripter.co/doc/tags-and-categories/#marking-files-to-not-be-exported

This all looks really ocol; too bad it's a bit out of my range, I'd like to
> understand it a little better!
>

I hope above helps!

To me the shell script idea feels easier, but I guess it's also a little
> brittle
>
>
>> PS: I publish the ox-hugo package website[3] the same way too, but using
>> Netlify (/which is the better than GitHub Pages or Gitlab CI IMO -- free
>> too/). See the footer of that site for the 1-file Org source.
>>
>
> Sticking with Github for now since all my course stuff is there, probably
> easiest for my studnets ot have everything in the same place.
>

Netlify can be thought of just a CI machine. Your site can live in
Github/Gitlab/etc. repos, but Netlify will link to those. So the site
source will stay exactly where it is.. just that now Netlify will be
receptive to the git commit actions on your repo and auto-deploy the site
with each commit. For example: The ox-hugo doc site source is on GitHub,
but it is published using Netlify (https://ox-hugo.scripter.co).

Another thing: GitHub Pages does not support https on custom domains..
Netlify does.


> thank you!
>

You are welcome.

And finally, let's move all non-Org discussion off the Org mailing list.

[1]: https://github.com/jwiegley/use-package/blob/master/.travis.yml

[2]:
https://github.com/jwiegley/use-package/blob/master/doc/setup-ox-hugo.el

[3]: https://github.com/blog/1509-personal-api-tokens

-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 8592 bytes --]

  reply	other threads:[~2017-12-08 22:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08 19:28 run shell command after publishing project Matt Price
2017-12-08 19:58 ` Kaushal Modi
2017-12-08 21:37   ` Matt Price
2017-12-08 22:19     ` Kaushal Modi [this message]
2017-12-18 22:21       ` Matt Price
2017-12-19 11:37 ` Rasmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY0TcZ5VwcJzjXVVNQLvqG3inVw6GB=WKXDp2vppKSY8Mg@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=moptop99@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).