Skip to content

docs: generate api docs #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Generate and publish docs

on:
push:
branches: [ awatt/doc-gen, main ] # remove my branch before merge!

env:
# Xcode 16.3 gets us Swift 6.1, required for docc merge
XCODE_VERSION: 16.3

jobs:
build:
name: Generate API docs and publish to GitHub pages
runs-on: macos-15

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: jdx/mise-action@5083fe46898c414b2475087cc79da59e7da859e8
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd
with:
xcode-version: ${{ env.XCODE_VERSION }}

- name: Install dependencies
run: tuist install --path Samples

- name: Generate project
run: tuist generate --path Samples --no-open

- name: Generate Docs
run: Scripts/generate_docs.sh

- name: Deploy to GitHub Pages
uses: crazy-max/ghaction-github-pages@df5cc2bfa78282ded844b354faee141f06b41865
with:
target_branch: gh-pages
build_dir: generated_docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions Samples/Workspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ let workspace = Workspace(
// Generate a scheme for each target in Package.swift for convenience
.modals("Modals"),
.modals("WorkflowModals"),
.scheme(
name: "Documentation",
buildAction: .buildAction(
targets: [
.project(path: "..", target: "Modals"),
.project(path: "..", target: "WorkflowModals"),
]
)
),
]
)

Expand Down
22 changes: 22 additions & 0 deletions Scripts/generate_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

BUILD_PATH=docs_build
MERGED_PATH=generated_docs

xcodebuild docbuild \
-scheme Documentation \
-derivedDataPath "$BUILD_PATH" \
-workspace Samples/ModalsDevelopment.xcworkspace \
-destination generic/platform=iOS \
DOCC_HOSTING_BASE_PATH='swift-modals' \
| xcpretty

find_archive() {
find "$BUILD_PATH" -type d -name "$1.doccarchive" -print -quit
}

xcrun docc merge \
$(find_archive Modals) \
$(find_archive WorkflowModals) \
--output-path "$MERGED_PATH" \
--synthesized-landing-page-name "swift-modals"
Loading