Skip to content
Merged
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
109 changes: 64 additions & 45 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,78 @@
name: Generate Documentation
name: Documentation

on:
push:
branches:
- main
- master
paths:
- 'Sources/**'
- 'Package.swift'
- 'docs-script.sh'
workflow_dispatch: # Allow manual triggering
branches: [main]
paths: ['Sources/**', 'Package.swift', 'scripts/**']
tags: ['*']
workflow_dispatch:

permissions:
contents: write
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
generate-docs:
name: Generate Swift-DocC Documentation
deploy:
name: Build & Deploy
runs-on: macos-15

steps:
- name: Checkout Project
uses: actions/checkout@v4

- name: Setup Swift
uses: swift-actions/setup-swift@v2
- uses: actions/checkout@v4
with:
swift-version: "6.0"

- name: Install jq
run: brew install jq

- name: Generate Documentation
run: ./docs-script.sh

- name: Check for documentation changes
id: docs_changed
fetch-depth: 0

- name: Determine version
id: version
run: |
if git diff --quiet docs/; then
echo "changed=false" >> $GITHUB_OUTPUT
if [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "version_path=v${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "is_release=true" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "version=latest" >> $GITHUB_OUTPUT
echo "version_path=" >> $GITHUB_OUTPUT
echo "is_release=false" >> $GITHUB_OUTPUT
fi

- name: Upload documentation artifacts
if: steps.docs_changed.outputs.changed == 'true'
uses: actions/upload-artifact@v4

- uses: swift-actions/setup-swift@v2
with:
name: documentation
path: docs/
retention-days: 30

- name: Summary
if: always()
swift-version: "6.0"

- name: Install dependencies
run: brew install jq

- name: Generate documentation
run: ./scripts/docs-script.sh

- uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages-work
fetch-depth: 0
continue-on-error: true

- name: Initialize gh-pages
run: |
if [ "${{ steps.docs_changed.outputs.changed }}" == "true" ]; then
echo "✅ Documentation generated successfully"
echo "📁 Documentation artifacts are available for download"
else
echo "ℹ️ No documentation changes detected"
if [ ! -d "gh-pages-work/.git" ]; then
mkdir -p gh-pages-work && cd gh-pages-work
git init && git checkout -b gh-pages
git remote add origin https://github.com/${{ github.repository }}.git || true
fi

- name: Deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: ./scripts/deploy-docs.sh "${{ steps.version.outputs.version_path }}" "${{ steps.version.outputs.is_release }}"

- uses: actions/configure-pages@v5

- uses: actions/upload-pages-artifact@v3
with:
path: gh-pages-work

- uses: actions/deploy-pages@v4
34 changes: 5 additions & 29 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/
Expand All @@ -23,53 +21,31 @@ xcuserdata/
*.xcscmblueprint
.DS_Store

## Obj-C/Swift specific
# Obj-C/Swift
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
# Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
.build/
.swiftpm/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# SwiftPM
.swiftpm/

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output

# Swift-DocC (documentation is generated and committed)
# Uncomment the following line if you want to ignore generated docs:
# docs/

# Generated documentation
docs/
17 changes: 2 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,7 @@ FueledUtils is a collection of utilities for iOS used often within projects at [

## Documentation

Documentation is available [here](https://fueled.github.io/ios-utilities/).

### Generating Documentation Locally

To generate the documentation locally using Swift-DocC:

```bash
./docs-script.sh
```

This will generate the documentation in the `./docs` directory. Open `./docs/index.html` in your browser to view it.

**Requirements:**
- Swift 6.0+ (Swift-DocC is included)
- `jq` (for parsing Package.swift): `brew install jq`
Documentation is automatically generated and available [here](https://fueled.github.io/ios-utilities/).

## Contributing

Expand All @@ -34,3 +20,4 @@ If you'd like to contribute to the project, please familiarise yourself with [CO
## License

This project is licensed under the Apache License, Version 2.0.

Loading