Skip to content

update documentaiton #4

update documentaiton

update documentaiton #4

# This workflow automates the process of generating and deploying documentation using DocC (Apple's documentation compiler).
# The workflow is triggered on push events to the 'main' branch and can also be manually triggered.
name: generateAndPublishDocc
on:
push:
branches: [main]
workflow_dispatch:
permissions:
pages: write
id-token: write
contents: read
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Select latest Xcode version
run: sudo xcode-select -s /Applications/Xcode_15.0.app
- name: Run Build Docs
run: |
REPOSITORY_NAME="${{ github.event.repository.name }}"
PACKAGE_NAME="GoodPersistence"
PACKAGE_NAME_LOWERCASE=$(echo "$PACKAGE_NAME" | tr '[:upper:]' '[:lower:]')
# Build the DocC archive using xcodebuild.
xcrun xcodebuild docbuild \
-scheme "$PACKAGE_NAME" \
-destination 'generic/platform=iOS Simulator' \
-derivedDataPath "$PWD/.derivedData"
# Process the DocC archive for static hosting.
$(xcrun --find docc) process-archive \
transform-for-static-hosting "$PWD/.derivedData/Build/Products/Debug-iphonesimulator/${PACKAGE_NAME}.doccarchive" \
--output-path ".docs" \
--hosting-base-path "$REPOSITORY_NAME"
# Create an index.html file to redirect the browser to the documentation path.
echo '<script>window.location.href += "/documentation/'"${PACKAGE_NAME_LOWERCASE}"'"</script>' > .docs/index.html
- 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 }}