Skip to content

Commit

Permalink
Meta: Add workflow that deploys man page updates to man.serenityos.org
Browse files Browse the repository at this point in the history
  • Loading branch information
IdanHo authored and awesomekling committed May 4, 2021
1 parent 04c3cdd commit d29e2dd
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/manpages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Generate man pages

on:
push:
paths:
- "Base/usr/share/man/**"

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
mkdir -p output/$(basename "$d")
done
- name: Convert markdown to html
run: |
find $MAN_DIR -iname '*.md' -type f -exec sh -c 'relative=$(realpath --relative-to=$MAN_DIR $0) && pandoc -f gfm -t html5 -s -o output/${relative%.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/[email protected]
with:
git-config-name: BuggieBot
git-config-email: [email protected]
branch: master
repository-name: SerenityOS/manpages-website
token: ${{ secrets.BUGGIEBOT }}
folder: output
Binary file added Meta/Websites/man.serenityos.org/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions Meta/Websites/man.serenityos.org/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<title>SerenityOS man pages</title>
</head>
<body>
<img src="banner.png" alt="SerenityOS">
<h1>SerenityOS man pages</h1>
<a href="man1/"><p>Man 1</p></a>
<a href="man1/"><p>Man 2</p></a>
<a href="man1/"><p>Man 3</p></a>
<a href="man1/"><p>Man 4</p></a>
<a href="man1/"><p>Man 5</p></a>
<a href="man1/"><p>Man 6</p></a>
<a href="man1/"><p>Man 7</p></a>
<a href="man1/"><p>Man 8</p></a>
</body>
</html>

0 comments on commit d29e2dd

Please sign in to comment.