diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..5b5aa91 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,61 @@ +name: Documentation + +on: + push: + branches: [ master ] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - name: Build Documentation + run: | + xcodebuild docbuild -scheme Animations \ + -destination 'generic/platform=iOS' \ + -derivedDataPath ./DerivedData + + - name: Process Documentation Archive + run: | + # Find the generated .doccarchive + DOCC_ARCHIVE=$(find ./DerivedData -name "*.doccarchive" | head -n 1) + + if [ -z "$DOCC_ARCHIVE" ]; then + echo "Error: No .doccarchive found" + exit 1 + fi + + echo "Found documentation archive: $DOCC_ARCHIVE" + + # Convert to static HTML + xcrun docc process-archive transform-for-static-hosting \ + "$DOCC_ARCHIVE" \ + --output-path ./docs \ + --hosting-base-path Animations + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./docs + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/GITHUB_PAGES_SETUP.md b/GITHUB_PAGES_SETUP.md new file mode 100644 index 0000000..5507eba --- /dev/null +++ b/GITHUB_PAGES_SETUP.md @@ -0,0 +1,45 @@ +# GitHub Pages Setup Instructions + +This repository includes a GitHub Actions workflow that automatically builds and deploys documentation to GitHub Pages. + +## Enabling GitHub Pages + +To enable GitHub Pages for this repository, follow these steps: + +1. Go to the repository on GitHub +2. Click on **Settings** (gear icon) +3. In the left sidebar, click on **Pages** (under "Code and automation") +4. Under "Build and deployment": + - **Source**: Select "GitHub Actions" +5. Save the configuration + +## How it Works + +The documentation workflow (`.github/workflows/documentation.yml`) automatically: + +1. Triggers on every push to the `master` branch +2. Uses `xcodebuild docbuild` to generate Swift documentation from the source code +3. Converts the DocC archive to static HTML +4. Deploys the generated documentation to GitHub Pages + +## Accessing the Documentation + +Once the workflow completes successfully, the documentation will be available at: + +https://mikelrob.github.io/Animations/documentation/animations/ + +## Manual Trigger + +You can also manually trigger the documentation build: + +1. Go to the **Actions** tab in the repository +2. Select the "Documentation" workflow +3. Click "Run workflow" +4. Select the branch (usually `master`) +5. Click "Run workflow" + +## Requirements + +- The workflow requires GitHub Pages to be enabled with "GitHub Actions" as the source +- The workflow uses macOS runners (required for Swift DocC tooling) +- Repository must have proper permissions set for the workflow (already configured in the workflow file) diff --git a/README.md b/README.md index 8f90179..e43f459 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Animations provide a small number of wrappers around UIKit that I think are nice to have when writing animation code. +[📖 View Documentation](https://mikelrob.github.io/Animations/documentation/animations/) + `Animation` is a wrapper around `UIView.animate` that provides an interface to chain animations. The `AnimationCoordinator` provides a interface to coordinate multiple `UIViewPropertyAnimator`s alongside each other.