Home Projects 3D Prints

Deploying md on GitHub pages

I spent the last couple days building md, a minimal Markdown static site generator.

This site is generated by md, and it's deployed on GitHub Pages using a simple GitHub Action:

 1name: build
 2
 3on:
 4  push:
 5    branches:
 6      - main
 7
 8jobs:
 9  deploy:
10    runs-on: ubuntu-18.04
11    steps:
12      - uses: actions/checkout@v2
13
14      - name: Install Go
15        uses: actions/setup-go@v2
16        with:
17          go-version: "^1.16.2"
18
19      - name: Install md
20        run: go get github.com/ruggi/md
21
22      - name: Build
23        run: md build
24
25      - name: Deploy
26        uses: peaceiris/actions-gh-pages@v3
27        if: github.ref == 'refs/heads/main'
28        with:
29          github_token: ${{ secrets.GITHUB_TOKEN }}
30          publish_dir: ./.md/out

Steps

The steps are pretty simple:

  1. Install Go via actions/setup-go@v2
  2. Install md via go get
  3. Build the local folder
  4. Deploy with peaceiris/actions-gh-pages

Repo config

Once the action runs, it will publish the output folder (./.md/out) on the gh-pages branch. You can set that to be the target for the deployment in the Pages section of the repository's settings:

settings