這兩天在GitHub上想要做一個braindump的博客,辦法是用ox-hugo把repo裏./org下的org文件譯到./content下的md文件.
我結合了下system crafter下emacs和hugo官網上關於github page設置hugo的兩個github action,publish.yml
寫成這樣:
name: Publish to GitHub Pages
on:
push:
branches:
- main # I'm now using main
pull_request: # as sugeested in the hugo website
jobs:
deploy: # from publish to deploy. I think it's not part of syntax.
runs-on: ubuntu-latest # change from latest to 20.04
steps:
- name: Check out
uses: actions/checkout@v2 # previously use v1 and no sub-things
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Install Emacs
run: sudo apt install emacs-nox --yes
- name: Build the md
run: emacs -Q --script publish.el
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
# extended: true
- name: Build the hugo site
run: hugo --minify
# - name: Publish generated content to GitHub Pages
# uses: JamesIves/[email protected]
# with:
# branch: gh-pages
# folder: public
- name: Deploy # as suggested on the hugo website
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
本來Install Emacs是在一個腳本裡,提示沒有權限,就直接貼在yaml裏面,就能執行了.但是它下載的文件中,在/lisp/org
下ol-x
的包一個都沒有,而ox-hugo
用到ol-info
這個org的包,就load不到,沒有辦法運行.
我懷疑可能下到的org版本是9.1.9太早,沒有這個包,就把自己org-mode的代碼revert回去9.1.9看了下,是有這個包的.但是我從apt下到的emacs裏沒這個包.有壇友知道為什麼,或者該怎麼辦嗎?我正打算把自家的org library複製上去到那個ubantu上的lisp/org
,但感覺蠢蠢的ww