Skip to content

Fix manpage build: remove deprecated mdbook field and fix index gener… #394

Fix manpage build: remove deprecated mdbook field and fix index gener…

Fix manpage build: remove deprecated mdbook field and fix index gener… #394

Workflow file for this run

name: Docs
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 2 * * *"
jobs:
build:
name: Build website artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout uutils.github.io Repository
uses: actions/checkout@v5
with:
repository: uutils/uutils.github.io
path: './uutils.github.io'
fetch-depth: 0
- name: Checkout Coreutils Repository
uses: actions/checkout@v5
with:
repository: uutils/coreutils
path: './coreutils'
fetch-depth: 0
- name: Checkout Findutils Repository
uses: actions/checkout@v5
with:
repository: uutils/findutils
path: './findutils'
fetch-depth: 0
- name: Install `rust` toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install system deps
run: |
sudo apt install libacl1-dev libselinux1-dev libsystemd-dev man2html
- name: Download tldr archive
run: |
curl https://tldr.sh/assets/tldr.zip --output coreutils/docs/tldr.zip
- name: Install necessary tools (mdbook and mdbook-toc)
uses: taiki-e/install-action@v2
with:
tool: mdbook,mdbook-toc
- name: Build Coreutils Docs
run: |
cd coreutils
cargo run --bin uudoc --all-features
cd docs
# Remove deprecated 'multilingual' field unsupported by newer mdbook
sed -i '/^multilingual/d' book.toml
mdbook build
- name: Generate Coreutils Manpages
run: |
cd coreutils
make install-manpages DESTDIR=../manpages
- name: Convert Manpages to HTML and Generate Index
run: |
mkdir -p manpages-html
# Convert manpages to HTML and collect names
manpage_names=""
for man in manpages/usr/local/share/man/man*/*.1; do
if [ -f "$man" ]; then
name=$(basename "$man" .1)
man2html -r "$man" > "manpages-html/${name}.html"
manpage_names="$manpage_names $name"
fi
done
# Generate index.html with links to all manpages
cat > manpages-html/index.html << 'HEADER'
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>uutils coreutils - Manual Pages</title>
<style>
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; max-width: 1200px; margin: 0 auto; padding: 20px; }
h1 { color: #333; }
.breadcrumb { margin-bottom: 20px; }
.breadcrumb a { color: #007acc; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.manpage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px; margin-top: 30px; }
.manpage-link { display: block; padding: 12px; background: #f5f5f5; border: 1px solid #ddd; border-radius: 5px; text-decoration: none; color: #333; text-align: center; font-family: monospace; font-weight: bold; font-size: 1.1em; transition: all 0.3s ease; }
.manpage-link:hover { background: #007acc; color: white; border-color: #007acc; transform: translateY(-2px); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
@media (prefers-color-scheme: dark) {
body { background: #1a1a1a; color: #e0e0e0; }
h1 { color: #e0e0e0; }
.manpage-link { background: #2a2a2a; border-color: #444; color: #e0e0e0; }
.manpage-link:hover { background: #007acc; color: white; border-color: #007acc; }
}
</style>
</head>
<body>
<div class="breadcrumb">
<a href="/">Home</a> /
<a href="/coreutils">Coreutils</a> /
<span>Manual Pages</span>
</div>
<h1>Manual Pages</h1>
<p>Complete manual pages for all uutils coreutils commands. Click on any command to view its full documentation.</p>
<div class="manpage-grid">
HEADER
for name in $(echo $manpage_names | tr ' ' '\n' | sort); do
echo " <a href=\"${name}.html\" class=\"manpage-link\">${name}</a>" >> manpages-html/index.html
done
cat >> manpages-html/index.html << 'FOOTER'
</div>
</body>
</html>
FOOTER
- name: Build Findutils Docs
run: |
cd findutils/docs
# Remove deprecated 'multilingual' field unsupported by newer mdbook
sed -i '/^multilingual/d' book.toml
mdbook build
- name: Run Zola
uses: shalzz/zola-deploy-action@v0.21.0
env:
BUILD_DIR: uutils.github.io
BUILD_ONLY: true
- name: Collect results into `public` folder
run: |
cp -r uutils.github.io/public public
cp -r coreutils/docs/book public/coreutils/docs
cp -r findutils/docs/book public/findutils/docs
mkdir -p public/coreutils/manpages
cp -r manpages-html/* public/coreutils/manpages/
- name: Upload artifact for checking the output
uses: actions/upload-artifact@v4
with:
path: ./public
- name: Upload artifact for pages
uses: actions/upload-pages-artifact@v4
with:
path: ./public
# dev-docs:
# name: generate the dev doc
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# repository: uutils/coreutils
# path: './coreutils'
# fetch-depth: 0
# - name: Install `rust` toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# default: true
# profile: minimal
# - name: Build dev documentation
# run: |
# cd coreutils
# cargo doc --no-deps --all-features --workspace
# - name: Deploy Docs
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./coreutils/target/doc
# destination_dir: coreutils/dev/
# build-report:
# name: generate the build report
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# repository: uutils/coreutils
# path: './coreutils'
# fetch-depth: 0
# - name: Install `rust` toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly
# default: true
# profile: minimal
# - name: Build report
# run: |
# cd coreutils
# cargo +nightly build --timings=html -Zunstable-options
# - name: Deploy build report
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./coreutils/target/cargo-timings/
# destination_dir: cargo-timings/
# Deployment job
deploy:
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'schedule'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4