Skip to content

Commit

Permalink
GitHub Actions to build and deploy docc documentations (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
rizwankce authored Oct 5, 2023
1 parent ce2cde3 commit 38b0b74
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
46 changes: 46 additions & 0 deletions .github/workflows/docc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy Documentation
on:
push:
branches: [main, dev]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: macos-13
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "15.0.0"
- name: Setup Config file
run: |
cp Basic-Car-Maintenance.xcconfig.template Basic-Car-Maintenance.xcconfig
- name: Run Build Docs
run: ./build-docc.sh
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: .docs
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
3 changes: 2 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ excluded: # paths to ignore during linting. Takes precedence over `included`.
- Pods
- Source/ExcludedFolder
- Source/ExcludedFile.swift
- Source/*/ExcludedFile.swift # Exclude files with a wildcard
- Source/*/ExcludedFile.swift
- .derivedData # Exclude files with a wildcard
analyzer_rules: # Rules run by `swiftlint analyze` (experimental)
- explicit_self

Expand Down
15 changes: 15 additions & 0 deletions build-docc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
##!/bin/sh

xcrun xcodebuild docbuild \
-scheme Basic-Car-Maintenance \
-destination 'generic/platform=iOS Simulator' \
-derivedDataPath "$PWD/.derivedData"

xcrun docc process-archive transform-for-static-hosting \
"$PWD/.derivedData/Build/Products/Debug-iphonesimulator/Basic-Car-Maintenance.doccarchive" \
--output-path ".docs" \
--hosting-base-path "Basic-Car-Maintenance"

echo '<script>window.location.href += "documentation/basic_car_maintenance"</script>' > .docs/index.html


0 comments on commit 38b0b74

Please sign in to comment.