Documentation - GitHub Actions #89
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a Swift project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift | |
# This workflow will build a Swift project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift | |
name: Build all platforms | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
schedule: | |
- cron: 0 0 * * * | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
generate_and_deploy_docs: | |
name: Build Documentation | |
runs-on: ${{ matrix.macos }} | |
strategy: | |
fail-fast: false | |
matrix: | |
xcode: ['latest'] | |
macos: ['macos-14'] | |
scheme: ['Lite'] | |
command: ['docbuild'] | |
platform: ['macOS', 'iOS', 'tvOS', 'watchOS'] | |
steps: | |
- name: Switch xcode to ${{ matrix.xcode }} | |
uses: maxim-lobanov/[email protected] | |
with: | |
xcode-version: ${{ matrix.xcode }} | |
- name: Double-check macOS version (${{ matrix.macos }}) | |
run: sw_vers | |
- name: Code Checkout | |
uses: actions/checkout@v2 | |
- name: Check xcodebuild version | |
run: xcodebuild -version | |
- name: Check xcode embedded SDKs | |
run: xcodebuild -showsdks | |
- name: Show buildable schemes | |
run: xcodebuild -list | |
- name: Show eligible build destinations for ${{ matrix.scheme }} | |
run: xcodebuild -showdestinations -scheme ${{ matrix.scheme }} | |
- name: Skip Macro Validation | |
run: defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES | |
- name: Generate DocC Documentation | |
id: generate_docs | |
run: | | |
xcodebuild docbuild -scheme Lite -destination generic/platform=${{ matrix.platform }} -derivedDataPath ./build | |
doccarchive_path=$(find ./build -name '*.doccarchive' -print -quit) | |
if [ -z "$doccarchive_path" ]; then | |
echo "No .doccarchive file found." | |
exit 1 | |
fi | |
echo "::set-output name=doccarchive_path::$doccarchive_path" | |
- name: Convert DocC Archive to Static Website | |
run: | | |
docc_path=$(xcrun --find docc) | |
if [ -z "$docc_path" ]; then | |
echo "docc command not found." | |
exit 1 | |
fi | |
${docc_path} process-archive transform-for-static-hosting ${{ steps.generate_docs.outputs.doccarchive_path }} \ | |
--output-path ./docs \ | |
--hosting-base-path /Lite | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: './docs' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |