Skip to content

Commit 7910bc5

Browse files
committed
chore(docs): refactor docs generation workflow
1 parent 536b0e9 commit 7910bc5

601 files changed

Lines changed: 775 additions & 1281 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 64 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,78 @@
1-
name: Generate Documentation
1+
name: Documentation
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- master
8-
paths:
9-
- 'Sources/**'
10-
- 'Package.swift'
11-
- 'docs-script.sh'
12-
workflow_dispatch: # Allow manual triggering
5+
branches: [main]
6+
paths: ['Sources/**', 'Package.swift', 'scripts/**']
7+
tags: ['*']
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: pages
17+
cancel-in-progress: false
1318

1419
jobs:
15-
generate-docs:
16-
name: Generate Swift-DocC Documentation
20+
deploy:
21+
name: Build & Deploy
1722
runs-on: macos-15
18-
1923
steps:
20-
- name: Checkout Project
21-
uses: actions/checkout@v4
22-
23-
- name: Setup Swift
24-
uses: swift-actions/setup-swift@v2
24+
- uses: actions/checkout@v4
2525
with:
26-
swift-version: "6.0"
27-
28-
- name: Install jq
29-
run: brew install jq
30-
31-
- name: Generate Documentation
32-
run: ./docs-script.sh
33-
34-
- name: Check for documentation changes
35-
id: docs_changed
26+
fetch-depth: 0
27+
28+
- name: Determine version
29+
id: version
3630
run: |
37-
if git diff --quiet docs/; then
38-
echo "changed=false" >> $GITHUB_OUTPUT
31+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
32+
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
33+
echo "version_path=v${{ github.ref_name }}" >> $GITHUB_OUTPUT
34+
echo "is_release=true" >> $GITHUB_OUTPUT
3935
else
40-
echo "changed=true" >> $GITHUB_OUTPUT
36+
echo "version=latest" >> $GITHUB_OUTPUT
37+
echo "version_path=" >> $GITHUB_OUTPUT
38+
echo "is_release=false" >> $GITHUB_OUTPUT
4139
fi
42-
43-
- name: Upload documentation artifacts
44-
if: steps.docs_changed.outputs.changed == 'true'
45-
uses: actions/upload-artifact@v4
40+
41+
- uses: swift-actions/setup-swift@v2
4642
with:
47-
name: documentation
48-
path: docs/
49-
retention-days: 30
50-
51-
- name: Summary
52-
if: always()
43+
swift-version: "6.0"
44+
45+
- name: Install dependencies
46+
run: brew install jq
47+
48+
- name: Generate documentation
49+
run: ./scripts/docs-script.sh
50+
51+
- uses: actions/checkout@v4
52+
with:
53+
ref: gh-pages
54+
path: gh-pages-work
55+
fetch-depth: 0
56+
continue-on-error: true
57+
58+
- name: Initialize gh-pages
5359
run: |
54-
if [ "${{ steps.docs_changed.outputs.changed }}" == "true" ]; then
55-
echo "✅ Documentation generated successfully"
56-
echo "📁 Documentation artifacts are available for download"
57-
else
58-
echo "ℹ️ No documentation changes detected"
60+
if [ ! -d "gh-pages-work/.git" ]; then
61+
mkdir -p gh-pages-work && cd gh-pages-work
62+
git init && git checkout -b gh-pages
63+
git remote add origin https://github.com/${{ github.repository }}.git || true
5964
fi
65+
66+
- name: Deploy
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
GITHUB_REPOSITORY: ${{ github.repository }}
70+
run: ./scripts/deploy-docs.sh "${{ steps.version.outputs.version_path }}" "${{ steps.version.outputs.is_release }}"
71+
72+
- uses: actions/configure-pages@v5
73+
74+
- uses: actions/upload-pages-artifact@v3
75+
with:
76+
path: gh-pages-work
77+
78+
- uses: actions/deploy-pages@v4

.gitignore

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Xcode
22
#
3-
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4-
53
## Build generated
64
build/
75
DerivedData/
@@ -23,53 +21,31 @@ xcuserdata/
2321
*.xcscmblueprint
2422
.DS_Store
2523

26-
## Obj-C/Swift specific
24+
# Obj-C/Swift
2725
*.hmap
2826
*.ipa
2927
*.dSYM.zip
3028
*.dSYM
3129

32-
## Playgrounds
30+
# Playgrounds
3331
timeline.xctimeline
3432
playground.xcworkspace
3533

3634
# Swift Package Manager
37-
#
38-
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
39-
# Packages/
4035
.build/
36+
.swiftpm/
4137

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

5041
# Carthage
51-
#
52-
# Add this line if you want to avoid checking in source code from Carthage dependencies.
53-
# Carthage/Checkouts
54-
5542
Carthage/Build
5643

57-
# SwiftPM
58-
.swiftpm/
59-
6044
# fastlane
61-
#
62-
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
63-
# screenshots whenever they are needed.
64-
# For more information about the recommended setup visit:
65-
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
66-
6745
fastlane/report.xml
6846
fastlane/Preview.html
6947
fastlane/screenshots
7048
fastlane/test_output
7149

72-
# Swift-DocC (documentation is generated and committed)
73-
# Uncomment the following line if you want to ignore generated docs:
74-
# docs/
75-
50+
# Generated documentation
51+
docs/

README.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,7 @@ FueledUtils is a collection of utilities for iOS used often within projects at [
1111

1212
## Documentation
1313

14-
Documentation is available [here](https://fueled.github.io/ios-utilities/).
15-
16-
### Generating Documentation Locally
17-
18-
To generate the documentation locally using Swift-DocC:
19-
20-
```bash
21-
./docs-script.sh
22-
```
23-
24-
This will generate the documentation in the `./docs` directory. Open `./docs/index.html` in your browser to view it.
25-
26-
**Requirements:**
27-
- Swift 6.0+ (Swift-DocC is included)
28-
- `jq` (for parsing Package.swift): `brew install jq`
14+
Documentation is automatically generated and available [here](https://fueled.github.io/ios-utilities/).
2915

3016
## Contributing
3117

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

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

0 commit comments

Comments
 (0)