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 19:58:09 +0000	[thread overview]
Message-ID: <CAFyQvY37NHTrXtGAJdzkCY8uVU1qzHPvfsfMZ=gkJjqhWHjN9g@mail.gmail.com> (raw)
In-Reply-To: <CAN_Dec_eF7Dt-aexcGaULSJnuj=uQH4Y7OaM0RwZFF4qz2GV2Q@mail.gmail.com>

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

On Fri, Dec 8, 2017, 2:29 PM Matt Price <moptop99@gmail.com> wrote:

> Hi everyone,
> Feeling a little rude after a long absence in which I dropped all my
> non-work commitments -- but still here to ask a question!
>

Hello!

I'm setting up a new workflow using Kauhsal's ox-hugo.  I keep all my
> course materials in a few org files & publish to hugo-flavoured markdown.
>

Awesome! :D

  My source materials live in one git repo, and my website in another.
> After exporting any of my my courses to the local hugo directory, I'd like
> to run a shell script that I'll keep in my org-files directory.
>
> That script
> - cds to the website repo directory, commits changes to the website master
> branch, - runs hugo,
> - switches to the "public" directory of compiled html pages, which has a
> worktree checked out to  the  gh-pages branch,
> - commits changes there as well, and then
> - pushes both branches to github.
>
> The script seems to work OK, and now I would like to run it every time I
> export from the appropriate projects. Is there a good way for me to do
> this? I guess a hook that only runs under certain conditions?
>
> If I can get this to work, and then also auto export every time I commit
> the org-files to master (maybe with a post-commit git hook of ~emacsclient
> -e '(org-publish-project "course1"~ ?), then I will maybe be almost happy!
>

I haven't yet got to ox-publish to work with ox-hugo, because of the unique
flow for subtree-based exports where we want to export only subtrees with a
specific property (EXPORT_FILE_NAME).

But I was finally able to achieve something like that using a Makefile [1]
+ Netlify (or GitHub Pages/Travis CI or GitLab CI).

A very recent example (few days) is how I helped set up the use-package
website publishing flow.

- ox-hugo + Hugo using Makefile + GitHub Pages.

You *only* need to commit the use-package.org[2] to the GitHub repo, and
https://jwiegley.github.io/use-package/ updates in a minute or so. The
Travis CI simply calls "make doc". That takes care of:
- Installing dependencies if needed on the CI machine
- Exporting Org to Markdown using ox-hugo
- Running hugo
- Commiting published HTML to the gh-pages branch
- And the site gets deployed, just like that :)

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.

[1]: https://github.com/jwiegley/use-package/blob/master/doc/Makefile

[2]: https://github.com/jwiegley/use-package/blob/master/use-package.org

[3]: https://ox-hugo.scripter.co/

-- 

Kaushal Modi

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

  reply	other threads:[~2017-12-08 19:58 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 [this message]
2017-12-08 21:37   ` Matt Price
2017-12-08 22:19     ` Kaushal Modi
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='CAFyQvY37NHTrXtGAJdzkCY8uVU1qzHPvfsfMZ=gkJjqhWHjN9g@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).