Skip to content

Commit d15f7db

Browse files
committed
Add action to generate and deploy lua docs with ldoc
1 parent 86c204f commit d15f7db

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/ldoc.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Generate Lua Documentation
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'scripts/**/*.lua'
8+
- 'docs/config.ld'
9+
- 'util/ldoc.sh'
10+
- 'src/el/*.*'
11+
pull_request:
12+
branches: [main]
13+
paths:
14+
- 'scripts/**/*.lua'
15+
- 'docs/config.ld'
16+
- 'util/ldoc.sh'
17+
- 'src/el/*.*'
18+
workflow_dispatch:
19+
20+
jobs:
21+
generate-docs:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Install Lua and LuaRocks
29+
run: |
30+
sudo apt-get update
31+
sudo apt-get install -y lua5.4 liblua5.4-dev luarocks
32+
33+
- name: Install ldoc from GitHub (latest)
34+
run: |
35+
sudo luarocks install penlight
36+
sudo luarocks install ldoc
37+
38+
- name: Generate documentation
39+
run: |
40+
sh util/ldoc.sh "${{ github.workspace }}/build/lua-html"
41+
42+
- name: Upload documentation artifact
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: lua-docs
46+
path: build/lua-html/
47+
retention-days: 14
48+
49+
- name: Push to documentation repository
50+
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'
51+
run: |
52+
cd build/lua-html
53+
git init
54+
git config user.name "github-actions[bot]"
55+
git config user.email "github-actions[bot]@users.noreply.github.com"
56+
git add .
57+
git commit -m "Update Lua documentation from ${{ github.sha }}"
58+
git push --force https://x-access-token:${{ secrets.DOCS_DEPLOY_TOKEN }}@github.com/kushview/element-ldoc.git HEAD:main

0 commit comments

Comments
 (0)