Compare commits

..

3 Commits

Author SHA1 Message Date
T. R. Bernstein
37aa0ef713 Add GitHub workflow file to generate docs
Some checks failed
Docs / docs (push) Has been cancelled
Docs / deploy (push) Has been cancelled
2026-03-13 02:09:56 +01:00
T. R. Bernstein
295b701be1 Add SwiftPackageIndex configuration file 2026-03-13 02:09:56 +01:00
T. R. Bernstein
984b0dd29c Add generate-docs command to build task
The Swift Docc has to run in a Linux container to be able to build the
documentation, as it needs access to the inotify.h header files.
2026-03-13 02:09:56 +01:00
2 changed files with 82 additions and 41 deletions

View File

@@ -26,50 +26,25 @@ jobs:
- name: Set up Swift - name: Set up Swift
uses: swift-actions/setup-swift@v3 uses: swift-actions/setup-swift@v3
with: with:
swift-version: '6.2.4' skip-verify-signature: true
- name: Inject DocC Plugin Dependency
run: |
if ! grep -q 'swift-docc-plugin' Package.swift; then
awk 'BEGIN{done=0} /dependencies: \[/ && done==0 {print; print "\t\t.package(url: \"https://github.com/apple/swift-docc-plugin.git\", from: \"1.4.0\"),"; done=1; next}1' Package.swift > Package.swift.tmp
mv Package.swift.tmp Package.swift
fi
- name: Generate Docs - name: Generate Docs
run: | run: |
swift package generate-documentation --target Inotify swift package add-dependency --from 1.4.0 "https://github.com/apple/swift-docc-plugin.git"
swift package generate-documentation --target TaskCLI for target in Inotify TaskCLI; do
- name: Transform for Static Hosting lower="${target,,}"
mkdir -p "./public/$lower"
swift package --allow-writing-to-directory "./public/$lower" \
generate-documentation --disable-indexing --transform-for-static-hosting \
--target "$target" \
--hosting-base-path "swift-inotify/$lower" \
--output-path "./public/$lower"
done
- name: Copy Index Page
run: | run: |
OUTPUTS=.build/plugins/Swift-DocC/outputs cp ./.github/workflows/index.tpl.html public/index.html
sed -i -e 's/{{project.name}}/Swift Inotify/g' public/index.html
mkdir -p ./public/inotify ./public/taskcli sed -i -e 's/{{project.tagline}}/🗂️ Monitor filesystem events on Linux using modern Swift concurrency/g' public/index.html
sed -i -e 's|{{project.links}}|<li><a href="inotify/documentation/inotify/">Inotify</a>: The actual library.</li><li><a href="taskcli/documentation/taskcli/">TaskCLI</a>: The project build command.</li>|g' public/index.html
docc process-archive transform-for-static-hosting \
"$OUTPUTS/Inotify.doccarchive" \
--output-path ./public/inotify \
--hosting-base-path swift-inotify/inotify
docc process-archive transform-for-static-hosting \
"$OUTPUTS/TaskCLI.doccarchive" \
--output-path ./public/taskcli \
--hosting-base-path swift-inotify/taskcli
- name: Create Index Page
run: |
cat > ./public/index.html <<'HTML'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Swift Inotify Documentation</title>
</head>
<body>
<h1>Swift Inotify Documentation</h1>
<ul>
<li><a href="inotify/documentation/inotify/">Inotify: The actual library.</a></li>
<li><a href="taskcli/documentation/taskcli/">TaskCLI: The project build command.</a></li>
</ul>
</body>
</html>
HTML
- name: Upload artifact - name: Upload artifact
uses: actions/upload-pages-artifact@v4 uses: actions/upload-pages-artifact@v4
with: with:

66
.github/workflows/index.tpl.html vendored Normal file

File diff suppressed because one or more lines are too long