
build-docc
Description
build-docc is a GitHub Action for generating Swift DocC documentation with support for multiple schemes and versioning.
This action builds your DocC archive using Xcode and outputs a static documentation website that you can deploy anywhere (GitHub Pages, S3, etc).
Features
- ๐ฏ Multiple Schemes Support - Build documentation for multiple frameworks/libraries in one go
- ๐ฆ Version Management - Automatic versioning with option to preserve or replace old versions
- ๐ Flexible Xcode Versions - Choose any Xcode version for building
- ๐ Static Hosting Ready - Generates documentation optimized for GitHub Pages or any static hosting
- ๐ Easy Integration - Simple YAML configuration with sensible defaults
Table of Contents
Quick Start
Basic Usage
- name: Build Documentation
uses: space-code/build-docc@v1
with:
schemes: '["MyFramework"]'
version: 'v1.0.0'
Complete Example with Deployment
name: Generate Documentation
on:
push:
tags:
- 'v*'
jobs:
build-and-deploy:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build Documentation
uses: space-code/build-docc@v1
with:
schemes: '["MyLib", "MyUI"]'
version: ${{ github.ref_name }}
keep-old-versions: 'true'
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
keep_files: true
Inputs
๐ Inputs
| Input |
Description |
Required |
Default |
schemes |
JSON array of schemes to build (e.g. ["MyLib", "MyUI"]) |
โ
Yes |
- |
version |
Documentation version (e.g. v1.0.0, latest) |
โ No |
latest |
xcode-version |
Xcode version to use for building |
โ No |
latest-stable |
keep-old-versions |
Keep old versions in docs/ directory |
โ No |
true |
Outputs
| Output |
Description |
docs-path |
Path to the generated docs folder |
version |
Version used for build |
Usage Examples
Single Framework
- uses: space-code/build-docc@v1
with:
schemes: '["MyFramework"]'
version: 'v1.0.0'
Multiple Frameworks
- uses: space-code/build-docc@v1
with:
schemes: '["CoreLib", "UIComponents", "Networking"]'
version: ${{ github.ref_name }}
Specific Xcode Version
- uses: space-code/build-docc@v1
with:
schemes: '["MyFramework"]'
version: 'v2.0.0'
xcode-version: '15.0'
Without Version Preservation
- uses: space-code/build-docc@v1
with:
schemes: '["MyFramework"]'
version: 'latest'
keep-old-versions: 'false'
Version Management
The action supports two modes for handling documentation versions:
Keep Old Versions (default)
When keep-old-versions: 'true' (default):
- Previous versions remain accessible
- New version is added alongside existing ones
- Perfect for maintaining documentation history
docs/
โโโ v1.0.0/
โ โโโ MyLib/
โโโ v1.1.0/
โ โโโ MyLib/
โโโ v2.0.0/
โโโ MyLib/
Replace Old Versions
When keep-old-versions: 'false':
- Previous versions are removed
- Only the new version is kept
- Useful for "latest" documentation or saving storage
docs/
โโโ latest/
โโโ MyLib/
Deployment to GitHub Pages
Complete Workflow
name: Documentation
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
build-docs:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
path: docs
continue-on-error: true
- name: Build Documentation
uses: space-code/build-docc@v1
with:
schemes: '["MyFramework"]'
version: ${{ github.ref_name }}
keep-old-versions: 'true'
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
keep_files: true
Enable GitHub Pages
- Go to your repository Settings โ Pages
- Set Source to "Deploy from a branch"
- Select gh-pages branch and / (root) folder
- Save
Your documentation will be available at:
https://your-username.github.io/your-repo/v1.0.0/MyFramework/
Generated Structure
The action generates the following structure:
docs/
โโโ v1.0.0/
โ โโโ MyLib/
โ โ โโโ index.html
โ โ โโโ documentation/
โ โ โโโ data/
โ โ โโโ css/
โ โโโ MyUI/
โ โโโ index.html
โ โโโ ...
โโโ v2.0.0/
โโโ MyLib/
โโโ ...
Each version contains fully static HTML documentation that can be hosted anywhere.
Advanced Usage
Using Outputs
- name: Build Documentation
id: docc
uses: space-code/build-docc@v1
with:
schemes: '["MyFramework"]'
version: 'v1.0.0'
- name: Archive Documentation
run: |
tar -czf docs.tar.gz ${{ steps.docc.outputs.docs-path }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: documentation-${{ steps.docc.outputs.version }}
path: docs.tar.gz
Matrix Build for Multiple Projects
jobs:
docs:
runs-on: macos-latest
strategy:
matrix:
project:
- name: 'Project A'
schemes: '["LibA", "UtilsA"]'
- name: 'Project B'
schemes: '["LibB"]'
steps:
- uses: actions/checkout@v4
- name: Build ${{ matrix.project.name }}
uses: space-code/build-docc@v1
with:
schemes: ${{ matrix.project.schemes }}
version: ${{ github.ref_name }}
FAQ
How do I find my scheme names?
# For Swift Package Manager
swift package describe | grep "Name:"
# For Xcode projects
xcodebuild -list
Can I use this with CocoaPods or Carthage?
Yes! As long as your project has Xcode schemes, the action will work. Just ensure your schemes are shared.
Communication
๐ค Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Author
Nikita Vasilev
License
build-docc is released under the MIT license. See LICENSE for details.