From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: Re: run shell command after publishing project Date: Fri, 8 Dec 2017 16:37:13 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="089e082bf660eb9920055fdafc30" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNQKc-00022c-1l for emacs-orgmode@gnu.org; Fri, 08 Dec 2017 16:37:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNQKa-0003cx-6z for emacs-orgmode@gnu.org; Fri, 08 Dec 2017 16:37:18 -0500 Received: from mail-pf0-x232.google.com ([2607:f8b0:400e:c00::232]:37249) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eNQKZ-0003cS-Td for emacs-orgmode@gnu.org; Fri, 08 Dec 2017 16:37:16 -0500 Received: by mail-pf0-x232.google.com with SMTP id n6so8157599pfa.4 for ; Fri, 08 Dec 2017 13:37:15 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" Cc: emacs-org list --089e082bf660eb9920055fdafc30 Content-Type: text/plain; charset="UTF-8" This sounds fantastic, Kaushal. I'm struggling to follow, so wl lask some questions inline. On Fri, Dec 8, 2017 at 2:58 PM, Kaushal Modi wrote: > On Fri, Dec 8, 2017, 2:29 PM Matt Price 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). > ok, great. > > 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 :) > > so, - 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 - looks like maybe the hugo html ends up in public, but then it gets moved somehow (can't quite figure out how) - the ox-hugo files are kept somewhere I guess - presumably any personal config has to be replicated somewhere on the web where travis can access it - is there any more setup that needs to be done on Travis? - I have 4 main org files; 3 of them get copied per-header, and one as a whole file. Is that an issue? This all looks really ocol; too bad it's a bit out of my range, I'd like to understand it a little better! 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. thank you! > > [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 > --089e082bf660eb9920055fdafc30 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This sounds fantastic, Kaushal. I'm struggling to foll= ow, so wl lask some questions inline.=C2=A0

On Fri, Dec 8, 2017 at 2:58 PM, Kaushal= Modi <kaushal.modi@gmail.com> wrote:
On Fri, Dec 8, 2017, 2:29 PM Matt Price <moptop99@gmail.com> wrote:
Hi everyone,
Fee= ling 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.=C2=A0 I keep all my course materials in a few org f= iles & publish to hugo-flavoured markdown.

Awesome! :D
=
=C2=A0 My source materials li= ve in one git repo, and my website in another.=C2=A0 After exporting any of= my my courses to the local hugo directory, I'd like to run a shell scr= ipt that I'll keep in my org-files directory.=C2=A0=C2=A0
<= div>
That script
- cds to the website repo dir= ectory, commits changes to the website master branch, - runs hugo,
- switches to the "public" directory of compiled html page= s, which has a worktree checked out to=C2=A0 the=C2=A0 gh-pages branch,
- commits changes there as well, and then
- push= es both branches to github.=C2=A0

The script = seems to work OK, and now I would like to run it every time I export from t= he appropriate projects. Is there a good way for me to do this? I guess a h= ook 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 f= or subtree-based exports where we want to export only subtrees with a speci= fic property (EXPORT_FILE_NAME).=C2=A0

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

<= div>ok, great. =C2=A0

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

- ox-hugo + Hugo usi= ng Makefile + GitHub Pages.=C2=A0

You *only* need = to commit the use-pack= age.org[2] to the GitHub repo, and https://jwiegley.github.io/use-packa= ge/ updates in a minute or so. The Travis CI simply calls "make do= c". 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 br= anch
- And the site gets deployed, just like that :)
so,
- 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
- looks like maybe the hugo html ends up in public, but then it get= s moved somehow (can't quite figure out how)
- the ox-hugo fi= les are kept somewhere I guess
- presumably any personal config h= as to be replicated somewhere on the web where travis can access it
- is there any more setup that needs to be done on Travis?
- I= have 4 main org files; 3 of them get copied per-header, and one as a whole= file.=C2=A0 Is that an issue?

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

To me the shell scri= pt idea feels easier, but I guess it's also a little brittle
<= div>=C2=A0
PS: I publis= h the ox-hugo package website[3] the same way too, but using Netlify (/whic= h is the better than GitHub Pages or Gitlab CI IMO -- free too/). See the f= ooter of that site for the 1-file Org source.=C2=A0
=
Sticking with Github for now since all my course stuff is th= ere, probably easiest for my studnets ot have everything in the same place.= =C2=A0


thank you!


[2]:=C2=A0https://g= ithub.com/jwiegley/use-package/blob/master/use-package.org


<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">
--

Kaushal Modi


--089e082bf660eb9920055fdafc30--