Repository navigation
67 lines (66 loc) · 2.64 KB
/
Copy pathdoc.yml
File metadata and controls
67 lines (66 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#
# SPDX-FileCopyrightText: (c) 2026 Ring Zero Desenvolvimento de Software LTDA
# SPDX-License-Identifier: MIT OR GPL-2.0-only
#
name: Build Docs
on:
pull_request:
push:
branches:
- master
release:
types:
- published
workflow_dispatch:
concurrency:
group: ${{ github.event_name == 'pull_request' && github.ref || 'gh-pages' }}
jobs:
build:
name: Build docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Checkout Lunatik's style
# the site takes the template, the stylesheet and the search of Lunatik's, whose master config.ld reads at .lunatik/
run: git clone --depth 1 https://github.com/luainkernel/lunatik.git .lunatik
- name: Setup dependencies
run: |
# LDoc runs on lua5.4, the newest Lua the archive builds it for, and discount, which the archive dropped, comes from luarocks for that Lua
bash harness/tools/retry.sh 5 90 sudo sh -c 'apt-get update && apt-get install -y lua5.5 lua5.4 lua-ldoc luarocks liblua5.4-dev libmarkdown2-dev'
bash harness/tools/retry.sh 5 90 sudo luarocks --lua-version=5.4 install discount DISCOUNT_INCDIR=/usr/include/$(gcc -print-multiarch) DISCOUNT_LIBDIR=/usr/lib/$(gcc -print-multiarch)
- name: Name the release the site serves
env:
GH_TOKEN: ${{ github.token }}
run: echo "RELEASE=$(gh api repos/${{ github.repository }}/releases/latest --jq .tag_name || true)" >> "$GITHUB_ENV"
- name: Build docs
run: |
# the template reads the release a page belongs to and the releases the site serves: the root's pages
# name the latest release, and master's, under master/, name none
case "${{ github.event_name }}" in
release|workflow_dispatch) echo "$RELEASE" > doc/.tags ;;
*) : > doc/.tags ;;
esac
echo "$RELEASE" > doc/.releases
ldoc .
cp .lunatik/doc/style/site.js site/
cp -r .lunatik/doc/style/fonts site/
lua5.5 .lunatik/doc/style/search.lua site
- name: Deploy the release
# a dispatch rebuilds the root from master, for v0.1, whose tree has no config.ld
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site
keep_files: true
- name: Deploy master
if: ${{ github.event_name == 'push' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site
destination_dir: master
keep_files: true