-
Notifications
You must be signed in to change notification settings - Fork 17
88 lines (76 loc) · 2.85 KB
/
Copy pathdocs.yml
File metadata and controls
88 lines (76 loc) · 2.85 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Docs
on:
push:
branches:
- 'main'
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
# gh-pages deployments append commits to a shared branch; serialize them
concurrency:
group: docs-deploy
cancel-in-progress: false
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
# mike commits the built site onto the gh-pages branch
fetch-depth: 0
- uses: leafo/gh-actions-lua@v13
with:
luaVersion: "luajit-2.1"
# DepCtrl relies on Lua 5.2 features (table.unpack, __pairs/__len)
luaCompileFlags: "XCFLAGS=-DLUAJIT_ENABLE_LUA52COMPAT"
- uses: luarocks/gh-actions-luarocks@v7
# moonscript loader
- run: luarocks install moonscript
# lfs (Aegisub provides an internal copy)
- run: luarocks install luafilesystem
# CLI argument parsing
- run: luarocks install argparse
# json schema validation
- run: luarocks install lua-schema
- run: luarocks install lpeg
- uses: actions/setup-python@v6
with:
python-version: '3.x'
- run: pip install mkdocs-material mike mkdocs-literate-nav
- name: Generate docs
timeout-minutes: 5
run: lua depctrl.lua generate-docs
- name: Determine version slug
id: version
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
echo "slug=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
echo "release=true" >> "$GITHUB_OUTPUT"
else
# branch deploys (main pushes and manual dispatches) use the branch name,
# with slashes flattened so the slug stays a single path segment
echo "slug=${GITHUB_REF_NAME//\//-}" >> "$GITHUB_OUTPUT"
echo "release=false" >> "$GITHUB_OUTPUT"
fi
- name: Configure committer
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Publish to gh-pages
run: |
slug='${{ steps.version.outputs.slug }}'
if [[ "${{ steps.version.outputs.release }}" == "true" ]]; then
# releases also move the 'latest' alias, and the site root redirects to it
mike deploy --push --update-aliases "$slug" latest
mike set-default --push latest
else
mike deploy --push "$slug"
# Before the first release there is no 'latest' for the root to point at, so a main
# deploy claims the root; once a release exists it owns the root and main leaves it be.
# Feature-branch previews never touch the root.
if [[ "${GITHUB_REF}" == "refs/heads/main" ]] && ! mike list | grep -qw latest; then
mike set-default --push "$slug"
fi
fi