diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..8537e60 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,86 @@ +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: ubuntu-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 Docs + run: | + swift package generate-documentation --target Inotify + swift package generate-documentation --target TaskCLI + - name: Transform for Static Hosting + run: | + OUTPUTS=.build/plugins/Swift-DocC/outputs + + mkdir -p ./public/inotify ./public/taskcli + + 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' + + +
+ +