Skip to content

Commit

Permalink
Add gh action to build documentation site
Browse files Browse the repository at this point in the history
Related lunarmodules#332.

Add doc-site target to make file and yml file to build the docs.
Following domenic's guide [1] but using leafo's gh actions like
luacheck.yml.

Builds the documentation for ldoc using the checked out version of ldoc
and uses peaceiris/actions-gh-pages to publish.

Once merged, docs will be available on https://lunarmodules.github.io/LDoc

[1]: https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
  • Loading branch information
idbrii committed Jun 23, 2021
1 parent 1479510 commit 38b0bf8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Based on https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
name: Build Docs
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
build:
name: Build docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Lua
uses: leafo/gh-actions-lua@v8
with:
luaVersion: 5.4
- name: Setup Lua Rocks
uses: leafo/gh-actions-luarocks@v4
- name: Setup dependencies
run: luarocks install --only-deps https://raw.githubusercontent.com/lunarmodules/LDoc/master/ldoc-scm-3.rockspec
- name: Build docs
run: make doc-site
- name: Deploy
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ test-tables:

test-clean: clean-basic clean-example clean-md clean-tables

doc-site:
cd $(_REPODIR)/doc && lua $(_REPODIR)/ldoc.lua .

CLEAN=&& lua $(_REPODIR)/ldoc.lua . && rd /S /Q cdocs && cp -rf doc cdocs

clean-basic:
Expand Down

0 comments on commit 38b0bf8

Please sign in to comment.