Fix Documentation Build #131
This file contains hidden or 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
| name: Documentation | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| jobs: | |
| build-docs: | |
| runs-on: macos-latest | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Install Swift 6.2 | |
| uses: compnerd/gha-setup-swift@main | |
| with: | |
| source: swift.org | |
| swift-version: swift-6.2-release | |
| swift-build: 6.2-RELEASE | |
| - name: Generate Documentation | |
| run: | | |
| restore() { git checkout -- Package.swift; } | |
| trap restore EXIT | |
| sed -i.bak '/^ dependencies: \[/s/\[/[.package(url: "https:\/\/github.com\/apple\/swift-docc-plugin.git", from: "1.4.4"),/' Package.swift && rm -f Package.swift.bak | |
| swift package --allow-writing-to-directory documentation generate-documentation --target SwiftDisc --output-path documentation --transform-for-static-hosting --hosting-base-path SwiftDisc | |
| - name: Upload Pages Artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./documentation | |
| deploy-docs: | |
| needs: build-docs | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: macos-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |