Add GitHub workflow file to generate docs
This commit is contained in:
83
.github/workflows/docs.yml
vendored
Normal file
83
.github/workflows/docs.yml
vendored
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
name: Docs
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "pages"
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docs:
|
||||||
|
runs-on: macos-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- name: Set up Pages
|
||||||
|
uses: actions/configure-pages@v5
|
||||||
|
- name: Set up Swift
|
||||||
|
uses: swift-actions/setup-swift@v3
|
||||||
|
with:
|
||||||
|
swift-version: '6.2.4'
|
||||||
|
- 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 Inotify Docs
|
||||||
|
uses: fwcd/swift-docc-action@v1
|
||||||
|
with:
|
||||||
|
target: Inotify
|
||||||
|
output: ./public/inotify
|
||||||
|
transform-for-static-hosting: 'true'
|
||||||
|
disable-indexing: 'true'
|
||||||
|
hosting-base-path: swift-inotify/inotify
|
||||||
|
- name: Generate TaskCLI Docs
|
||||||
|
uses: fwcd/swift-docc-action@v1
|
||||||
|
with:
|
||||||
|
target: TaskCLI
|
||||||
|
output: ./public/taskcli
|
||||||
|
transform-for-static-hosting: 'true'
|
||||||
|
disable-indexing: 'true'
|
||||||
|
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
|
||||||
|
uses: actions/upload-pages-artifact@v4
|
||||||
|
with:
|
||||||
|
path: ./public
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: docs
|
||||||
|
steps:
|
||||||
|
- name: Deploy Docs
|
||||||
|
uses: actions/deploy-pages@v4
|
||||||
Reference in New Issue
Block a user