久しぶりに公開日記をつけてみることにした。なんかTwitterやブログのような「人との関わり」を前提とする仕組みが息苦しくなった。三日坊主になる気がするが、まぁ始めてみて、ダメだったらやめよう。
もともと2000年から公開日記をつけていた。記録では2017年9月までつけてたことになっている。前職で持っていたサーバは2019年3月まで動いていたはずだが、その前に記録をやめたようだ。
もともと「やらなければならないこと」だけで一日が終わらないようにと始めたはずの日記だが、いつの頃か初心を忘れていた。markdownからブログにするサービスをいろいろ探したが、いまいちピンとくるのがなかったので、自分で作ることに。まずはMDをpandocでhtmlにする仕組みをつくって、GitHub Actionsを設定してみた。YAMLファイルはこんな感じ。
# This is a basic workflow to help you get started with Actions
name: Deploy GitHub Pages
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
push:
branches: [ main ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a single command using the runners shell
- name: install make and pandoc
run: sudo apt-get install -y make pandoc
- name: Run a one-line script
run: make
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
peaceiris/actions-gh-pages@v3を使うことで非常に簡単にデプロイできる。毎回pandocをインストールするのがアホらしいが、これは後でなんとかしよう。デフォルトでgh_pagesというブランチにpublishされ、publish_dirで指定したディレクトリがルートディレクトリとなる。なので、GitHub Pagesでページを公開する時には、Branchをgh_pages、ディレクトリは/(root)にしてやる必要がある。
いきなり日付を間違えてpushしてしまった。上記のYAMLもシンタックスハイライトされていないし、いろいろ要調整だな。
とりあえずシンタックスハイライトだけ直した。