blob: 38277f52195d86c76e7122d529112bf4c2b9d2dd (
plain)
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
|
name: Generate man pages
on:
push:
paths:
- "Base/usr/share/man/**"
- "Meta/Websites/man.serenityos.org/**"
env:
MAN_DIR: ${{ github.workspace }}/Base/usr/share/man/
jobs:
convert_using_pandoc:
runs-on: ubuntu-20.04
if: always() && github.repository == 'SerenityOS/serenity' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-pandoc@v1
with:
pandoc-version: '2.13'
- name: Prepare output directories
run: |
for d in $MAN_DIR*/; do
dir_name=$(basename "$d")
mkdir -p output/${dir_name/man}
done
- name: Convert markdown to html
run: |
cat << EOF > link-fixup.lua
function Link(el)
el.target = string.gsub(el.target, "%.md", ".html") -- fixup .md to .html links
el.target = string.gsub(el.target, "man", "", 1) -- fixup man1/???.html to 1/???.html links
return el
end
EOF
find $MAN_DIR -iname '*.md' -type f -exec sh -c 'relative_path=$(realpath --relative-to=$MAN_DIR $0) && stripped_path=${relative_path#man} && pandoc -f gfm -t html5 -s --lua-filter=link-fixup.lua -o output/${stripped_path%.md}.html ${0}' {} \;
- name: Generate man page listings
run: |
for d in output/*/; do
dir_name=$(basename "$d")
echo "<!DOCTYPE html><html><head><title>$dir_name</title></head><body>" > "$d/index.html"
for f in $d/*; do
file_name=$(basename "$f")
if [[ "$file_name" == "index.html" ]]; then
continue
fi
echo "<a href=\"$file_name\"><p>${file_name%.html}</p></a>" >> "$d/index.html"
done
echo "</body></html>" >> "$d/index.html"
done
- name: Copy pre-made files
run: |
cp -R Meta/Websites/man.serenityos.org/* output/
- name: Deploy to github pages
uses: JamesIves/github-pages-deploy-action@4.1.1
with:
git-config-name: BuggieBot
git-config-email: buggiebot@serenityos.org
branch: master
repository-name: SerenityOS/manpages-website
token: ${{ secrets.BUGGIEBOT }}
folder: output
|