diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..9fe1610
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,60 @@
+---
+name: 🐛 Bug Report
+about: Report a bug to help us improve
+title: '[BUG] '
+labels: bug, needs-triage
+assignees: ''
+---
+
+## Bug Description
+
+
+
+## Steps to Reproduce
+
+
+
+1. Go to '...'
+2. Click on '...'
+3. Scroll down to '...'
+4. See error
+
+## Expected Behavior
+
+
+
+## Actual Behavior
+
+
+
+## Screenshots / Logs
+
+
+
+```
+
+```
+
+## Environment
+
+
+
+- **OS**: [e.g., macOS 14.0, iOS 17.0, watchOS 9.0]
+- **Version**: [e.g., 1.2.3]
+
+## Additional Context
+
+
+
+## Possible Solution
+
+
+
+## Related Issues
+
+
+
+---
+
+**Priority**:
+**Impact**:
\ No newline at end of file
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..3e436f9
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,47 @@
+## Description
+
+
+
+## Type of Change
+
+
+
+- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
+- [ ] ✨ New feature (non-breaking change which adds functionality)
+- [ ] 📝 Documentation update
+- [ ] 🎨 Code style update (formatting, renaming)
+- [ ] ♻️ Code refactoring (no functional changes)
+- [ ] ⚡ Performance improvement
+- [ ] 🔧 Build configuration change
+- [ ] 🔒 Security update
+
+## Related Issues
+
+
+
+Fixes #
+Related to #
+
+## Changes Made
+
+
+
+-
+-
+-
+
+## Breaking Changes
+
+
+
+## Migration Guide
+
+
+
+## Additional Notes
+
+
+
+---
+
+**Reviewers**: @
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..4985b2f
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,303 @@
+name: build-docc
+
+on:
+ pull_request:
+ branches: [main]
+ push:
+ branches: [main]
+ workflow_dispatch:
+
+concurrency:
+ group: build-docc-${{ github.head_ref }}
+ cancel-in-progress: true
+
+jobs:
+ test-single-scheme:
+ name: Test Single Scheme
+ runs-on: macos-latest
+ steps:
+ - name: Checkout action repo
+ uses: actions/checkout@v4
+ with:
+ path: docc-action
+
+ - name: Create test Swift project
+ run: |
+ swift package init --type library --name TestLib
+
+ cat > Sources/TestLib/TestLib.swift << 'EOF'
+ /// A test library for DocC generation
+ ///
+ /// This library demonstrates DocC documentation generation.
+ public struct TestLib {
+ /// Creates a new instance
+ public init() {}
+
+ /// A test function
+ /// - Returns: A greeting string
+ public func greet() -> String {
+ return "Hello, DocC!"
+ }
+ }
+ EOF
+
+ - name: Build Documentation
+ uses: ./docc-action
+ with:
+ schemes: '["TestLib"]'
+ version: 'v1.0.0'
+ keep-old-versions: 'false'
+
+ - name: Verify Output
+ run: |
+ echo "📋 Checking documentation structure..."
+
+ if [ ! -d "docs/v1.0.0/TestLib" ]; then
+ echo "❌ Documentation directory not found"
+ exit 1
+ fi
+
+ if [ ! -f "docs/v1.0.0/TestLib/index.html" ]; then
+ echo "❌ index.html not found"
+ exit 1
+ fi
+
+ if [ ! -d "docs/v1.0.0/TestLib/documentation" ]; then
+ echo "❌ documentation directory not found"
+ exit 1
+ fi
+
+ echo "✅ Single scheme test passed"
+
+ echo "📁 Generated structure:"
+ tree -L 4 docs/ || find docs/ -type f | head -20
+
+ test-multiple-schemes:
+ name: Test Multiple Schemes
+ runs-on: macos-latest
+ steps:
+ - name: Checkout action repo
+ uses: actions/checkout@v4
+ with:
+ path: action
+
+ - name: Create test project with multiple targets
+ run: |
+ cat > Package.swift << 'EOF'
+ // swift-tools-version: 5.9
+ import PackageDescription
+
+ let package = Package(
+ name: "MultiTarget",
+ products: [
+ .library(name: "CoreLib", targets: ["CoreLib"]),
+ .library(name: "UILib", targets: ["UILib"]),
+ ],
+ targets: [
+ .target(name: "CoreLib"),
+ .target(name: "UILib", dependencies: ["CoreLib"]),
+ ]
+ )
+ EOF
+
+ # CoreLib
+ mkdir -p Sources/CoreLib
+ cat > Sources/CoreLib/CoreLib.swift << 'EOF'
+ /// Core functionality library
+ public struct CoreLib {
+ public init() {}
+
+ /// Core function
+ public func process() -> String {
+ return "Core processing"
+ }
+ }
+ EOF
+
+ # UILib
+ mkdir -p Sources/UILib
+ cat > Sources/UILib/UILib.swift << 'EOF'
+ import CoreLib
+
+ /// UI components library
+ public struct UILib {
+ public init() {}
+
+ /// UI function
+ public func render() -> String {
+ return "UI rendering"
+ }
+ }
+ EOF
+
+ - name: Build Documentation
+ uses: ./action
+ with:
+ schemes: '["CoreLib", "UILib"]'
+ version: 'v1.0.0'
+ keep-old-versions: 'false'
+
+ - name: Verify Multiple Schemes
+ run: |
+ echo "📋 Checking multiple schemes..."
+
+ for SCHEME in CoreLib UILib; do
+ if [ ! -d "docs/v1.0.0/$SCHEME" ]; then
+ echo "❌ $SCHEME documentation not found"
+ exit 1
+ fi
+
+ if [ ! -f "docs/v1.0.0/$SCHEME/index.html" ]; then
+ echo "❌ $SCHEME index.html not found"
+ exit 1
+ fi
+
+ echo "✅ $SCHEME documentation generated"
+ done
+
+ echo "✅ Multiple schemes test passed"
+
+ test-version-preservation:
+ name: Test Version Preservation
+ runs-on: macos-latest
+ steps:
+ - name: Checkout action repo
+ uses: actions/checkout@v4
+ with:
+ path: action
+
+ - name: Create test project
+ run: |
+ swift package init --type library --name VersionTest
+
+ cat > Sources/VersionTest/VersionTest.swift << 'EOF'
+ /// Version test library
+ public struct VersionTest {
+ public init() {}
+ public func version() -> String { return "1.0" }
+ }
+ EOF
+
+ - name: Build v1.0.0 Documentation
+ uses: ./action
+ with:
+ schemes: '["VersionTest"]'
+ version: 'v1.0.0'
+ keep-old-versions: 'false'
+
+ - name: Verify v1.0.0
+ run: |
+ if [ ! -d "docs/v1.0.0/VersionTest" ]; then
+ echo "❌ v1.0.0 not found"
+ exit 1
+ fi
+ echo "✅ v1.0.0 created"
+
+ - name: Update source code
+ run: |
+ cat > Sources/VersionTest/VersionTest.swift << 'EOF'
+ /// Version test library (updated)
+ public struct VersionTest {
+ public init() {}
+ public func version() -> String { return "2.0" }
+
+ /// New feature in v2
+ public func newFeature() -> String { return "New!" }
+ }
+ EOF
+
+ - name: Build v2.0.0 Documentation
+ uses: ./action
+ with:
+ schemes: '["VersionTest"]'
+ version: 'v2.0.0'
+ keep-old-versions: 'true'
+
+ - name: Verify Both Versions Exist
+ run: |
+ echo "📋 Checking version preservation..."
+
+ if [ ! -d "docs/v1.0.0/VersionTest" ]; then
+ echo "❌ v1.0.0 was deleted!"
+ exit 1
+ fi
+ echo "✅ v1.0.0 preserved"
+
+ if [ ! -d "docs/v2.0.0/VersionTest" ]; then
+ echo "❌ v2.0.0 not created"
+ exit 1
+ fi
+ echo "✅ v2.0.0 created"
+
+ echo "📁 Version structure:"
+ ls -la docs/
+
+ echo "✅ Version preservation test passed"
+
+ test-no-version-preservation:
+ name: Test Without Version Preservation
+ runs-on: macos-latest
+ steps:
+ - name: Checkout action repo
+ uses: actions/checkout@v4
+ with:
+ path: action
+
+ - name: Create test project
+ run: |
+ swift package init --type library --name NoPreserve
+
+ - name: Create fake old docs
+ run: |
+ mkdir -p docs/v0.9.0/NoPreserve
+ echo "old version" > docs/v0.9.0/NoPreserve/index.html
+
+ - name: Build new version WITHOUT preservation
+ uses: ./action
+ with:
+ schemes: '["NoPreserve"]'
+ version: 'v1.0.0'
+ keep-old-versions: 'false'
+
+ - name: Verify old version is gone
+ run: |
+ if [ -d "docs/v0.9.0" ]; then
+ echo "❌ Old version should be deleted when keep-old-versions=false"
+ exit 1
+ fi
+
+ if [ ! -d "docs/v1.0.0/NoPreserve" ]; then
+ echo "❌ New version not created"
+ exit 1
+ fi
+
+ echo "✅ Correctly deleted old versions"
+
+ test-summary:
+ name: Test Summary
+ needs: [test-single-scheme, test-multiple-schemes, test-version-preservation, test-no-version-preservation]
+ runs-on: ubuntu-latest
+ if: always()
+ steps:
+ - name: Generate Summary
+ run: |
+ echo "# 📊 Test Results" >> $GITHUB_STEP_SUMMARY
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "| Test | Status |" >> $GITHUB_STEP_SUMMARY
+ echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
+ echo "| Single Scheme | ${{ needs.test-single-scheme.result }} |" >> $GITHUB_STEP_SUMMARY
+ echo "| Multiple Schemes | ${{ needs.test-multiple-schemes.result }} |" >> $GITHUB_STEP_SUMMARY
+ echo "| Version Preservation | ${{ needs.test-version-preservation.result }} |" >> $GITHUB_STEP_SUMMARY
+ echo "| No Preservation | ${{ needs.test-no-version-preservation.result }} |" >> $GITHUB_STEP_SUMMARY
+
+ if [ "${{ needs.test-single-scheme.result }}" == "success" ] && \
+ [ "${{ needs.test-multiple-schemes.result }}" == "success" ] && \
+ [ "${{ needs.test-version-preservation.result }}" == "success" ] && \
+ [ "${{ needs.test-no-version-preservation.result }}" == "success" ]; then
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "## ✅ All tests passed!" >> $GITHUB_STEP_SUMMARY
+ else
+ echo "" >> $GITHUB_STEP_SUMMARY
+ echo "## ❌ Some tests failed" >> $GITHUB_STEP_SUMMARY
+ exit 1
+ fi
\ No newline at end of file
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 0000000..4e18f9f
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,37 @@
+name: lint
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
+
+concurrency:
+ group: lint-${{ github.head_ref }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+
+jobs:
+ discover-typos:
+ name: discover-typos
+ runs-on: macos-15
+ env:
+ DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
+ steps:
+ - uses: actions/checkout@v6
+
+ - name: Set up Python environment
+ run: |
+ python3 -m venv .venv
+ source .venv/bin/activate
+ pip install --upgrade pip
+ pip install codespell
+
+ - name: Discover typos
+ run: |
+ source .venv/bin/activate
+ codespell --ignore-words-list="hart,inout,msdos,sur" --skip="./.build/*,./.git/*"
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2f2231c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,360 @@
+
+
+
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](#quick-start)
+ - [Basic Usage](#basic-usage)
+ - [Complete Example with Deployment](#complete-example-with-deployment)
+- [Inputs](#inputs)
+- [Outputs](#outputs)
+- [Usage Examples](#usage-examples)
+ - [Single Framework](#single-framework)
+ - [Multiple Frameworks](#multiple-frameworks)
+ - [Specific Xcode Version](#specific-xcode-version)
+ - [Without Version Preservation](#without-version-preservation)
+- [Version Management](#version-management)
+ - [Keep Old Versions](#keep-old-versions-default)
+ - [Replace Old Versions](#replace-old-versions)
+- [Deployment to GitHub Pages](#deployment-to-github-pages)
+ - [Complete Workflow](#complete-workflow)
+ - [Enable GitHub Pages](#enable-github-pages)
+- [Generated Structure](#generated-structure)
+- [Advanced Usage](#advanced-usage)
+ - [Using Outputs](#using-outputs)
+ - [Matrix Build for Multiple Projects](#matrix-build-for-multiple-projects)
+- [FAQ](#faq)
+- [Communication](#communication)
+- [License](#license)
+
+## 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
+
+```yaml
+- uses: space-code/build-docc@v1
+ with:
+ schemes: '["MyFramework"]'
+ version: 'v1.0.0'
+```
+
+### Multiple Frameworks
+
+```yaml
+- uses: space-code/build-docc@v1
+ with:
+ schemes: '["CoreLib", "UIComponents", "Networking"]'
+ version: ${{ github.ref_name }}
+```
+
+### Specific Xcode Version
+
+```yaml
+- uses: space-code/build-docc@v1
+ with:
+ schemes: '["MyFramework"]'
+ version: 'v2.0.0'
+ xcode-version: '15.0'
+```
+
+### Without Version Preservation
+
+```yaml
+- 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
+
+```yaml
+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
+
+1. Go to your repository **Settings** → **Pages**
+2. Set **Source** to "Deploy from a branch"
+3. Select **gh-pages** branch and **/ (root)** folder
+4. 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
+
+```yaml
+- 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
+
+```yaml
+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?
+
+```bash
+# 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
+
+- 🐛 **Found a bug?** [Open an issue](https://github.com/space-code/build-docc/issues/new?template=bug_report.md)
+- 💡 **Have a feature request?** [Open an issue](https://github.com/space-code/build-docc/issues/new?template=feature_request.md)
+- ❓ **Questions?** [Start a discussion](https://github.com/space-code/build-docc/discussions)
+- 🔒 **Security issue?** Email nv3212@gmail.com
+
+## 🤝 Contributing
+
+Contributions are welcome! Please feel free to submit issues or pull requests.
+
+## Author
+
+**Nikita Vasilev**
+- Email: nv3212@gmail.com
+- GitHub: [@ns-vasilev](https://github.com/ns-vasilev)
+
+## License
+
+build-docc is released under the MIT license. See [LICENSE](LICENSE) for details.
+
+---
+
+
+
+**[⬆ back to top](#build-docc)**
+
+Made with ❤️ by [space-code](https://github.com/space-code)
+
+
\ No newline at end of file
diff --git a/action.yml b/action.yml
new file mode 100644
index 0000000..027600c
--- /dev/null
+++ b/action.yml
@@ -0,0 +1,149 @@
+name: 'Build DocC Documentation'
+description: 'Build Swift DocC documentation with versioning support'
+author: 'Nikita Vasilev'
+
+inputs:
+ schemes:
+ description: 'JSON array of schemes to build (e.g. ["MyLib", "MyUI"])'
+ required: true
+ version:
+ description: 'Documentation version'
+ required: false
+ default: 'latest'
+ xcode-version:
+ description: 'Xcode version'
+ required: false
+ default: 'latest-stable'
+ keep-old-versions:
+ description: 'Keep old versions in docs/'
+ required: false
+ default: 'true'
+
+outputs:
+ docs-path:
+ description: 'Path to the generated docs folder'
+ value: ${{ steps.build.outputs.docs_path }}
+ version:
+ description: 'Version used for build'
+ value: ${{ steps.parse.outputs.version }}
+
+runs:
+ using: 'composite'
+ steps:
+ - name: Setup Xcode
+ uses: maxim-lobanov/setup-xcode@v1
+ with:
+ xcode-version: ${{ inputs.xcode-version }}
+
+ - name: Parse Configuration
+ id: parse
+ shell: bash
+ run: |
+ SCHEMES='${{ inputs.schemes }}'
+ echo "schemes=$SCHEMES" >> $GITHUB_OUTPUT
+
+ REPO_NAME=$(basename "$GITHUB_REPOSITORY")
+ echo "repo_name=$REPO_NAME" >> $GITHUB_OUTPUT
+
+ PROJECT_NAME="${{ inputs.project-name }}"
+ if [ -z "$PROJECT_NAME" ]; then
+ PROJECT_NAME="$REPO_NAME"
+ fi
+ echo "project_name=$PROJECT_NAME" >> $GITHUB_OUTPUT
+
+ VERSION="${{ inputs.version }}"
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+
+ echo "📘 Documentation Build Configuration:"
+ echo " Repository: $REPO_NAME"
+ echo " Project: $PROJECT_NAME"
+ echo " Version: $VERSION"
+ echo " Schemes: $SCHEMES"
+
+ - name: Preserve Old Versions
+ shell: bash
+ run: |
+ if [ "${{ inputs.keep-old-versions }}" == "true" ] && [ -d "docs" ]; then
+ echo "📦 Saving existing documentation versions..."
+ mv docs docs-old
+ else
+ echo "🗑️ Old versions will not be preserved"
+ if [ -d "docs" ]; then
+ echo "🗑️ Removing existing docs directory..."
+ rm -rf docs
+ fi
+ fi
+
+ - name: Build DocC
+ id: build
+ shell: bash
+ run: |
+ set -o pipefail
+ set -e
+
+ VERSION="${{ steps.parse.outputs.version }}"
+ REPO_NAME="${{ steps.parse.outputs.repo_name }}"
+ SCHEMES=$(echo '${{ steps.parse.outputs.schemes }}' | jq -r '.[]')
+
+ BUILD="build"
+ DOCS_DIR="docs"
+
+ echo "📘 Building DocC for repository: $REPO_NAME"
+ echo "📘 Version: $VERSION"
+
+ # Clean build directory
+ rm -rf "$BUILD"
+ mkdir -p "$BUILD"
+
+ # Prepare docs directory
+ mkdir -p "$DOCS_DIR/$VERSION"
+
+ # Copy old versions if keeping them
+ if [ "${{ inputs.keep-old-versions }}" == "true" ] && [ -d "docs-old" ]; then
+ echo "📦 Restoring old documentation versions..."
+ cp -r docs-old/* "$DOCS_DIR/" 2>/dev/null || true
+ rm -rf docs-old
+ fi
+
+ # Generate DocC for each scheme
+ for SCHEME in $SCHEMES; do
+ echo ""
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+ echo "📘 Building DocC for $SCHEME ..."
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+
+ DERIVED_DATA="$BUILD/$SCHEME"
+
+ xcodebuild docbuild \
+ -scheme "$SCHEME" \
+ -destination 'platform=macOS' \
+ -derivedDataPath "$DERIVED_DATA"
+
+ ARCHIVE_PATH=$(find "$DERIVED_DATA" -name "$SCHEME.doccarchive" -type d | head -n 1)
+
+ if [ -z "$ARCHIVE_PATH" ]; then
+ echo "❌ No doccarchive for $SCHEME"
+ find "$DERIVED_DATA" -name "*.doccarchive" -type d || echo "No archives found"
+ exit 1
+ fi
+
+ echo "✅ Found archive: $ARCHIVE_PATH"
+
+ OUTPUT_PATH="$DOCS_DIR/$VERSION/$SCHEME"
+ mkdir -p "$OUTPUT_PATH"
+
+ HOSTING_BASE_PATH="$REPO_NAME/$VERSION/$SCHEME"
+ echo "📘 Using hosting base path: $HOSTING_BASE_PATH"
+
+ $(xcrun --find docc) process-archive \
+ transform-for-static-hosting \
+ "$ARCHIVE_PATH" \
+ --output-path "$OUTPUT_PATH" \
+ --hosting-base-path "$HOSTING_BASE_PATH"
+
+ echo "✅ $SCHEME docs ready at $OUTPUT_PATH"
+ done
+
+ echo "docs_path=$DOCS_DIR" >> $GITHUB_OUTPUT
+ echo ""
+ echo "🎉 Documentation generated for $REPO_NAME version $VERSION"
diff --git a/resources/build-docc.png b/resources/build-docc.png
new file mode 100644
index 0000000..9499a55
Binary files /dev/null and b/resources/build-docc.png differ