|
7 | 7 |
|
8 | 8 | jobs:
|
9 | 9 | build:
|
10 |
| - runs-on: ubuntu-latest |
11 |
| - |
| 10 | + runs-on: macos-12 |
12 | 11 | steps:
|
13 |
| - - uses: actions/checkout@v2 |
14 |
| - - name: Generate Documentation |
15 |
| - uses: SwiftDocOrg/swift-doc@master |
| 12 | + - name: Checkout Package |
| 13 | + uses: actions/checkout@v2 |
| 14 | + with: |
| 15 | + fetch-depth: 0 |
| 16 | + |
| 17 | + - name: Checkout swift-docc |
| 18 | + uses: actions/checkout@v2 |
| 19 | + with: |
| 20 | + repository: apple/swift-docc |
| 21 | + ref: main |
| 22 | + path: swift-docc |
| 23 | + - name: Cache DocC |
| 24 | + id: cache-docc |
| 25 | + uses: actions/cache@v2 |
16 | 26 | with:
|
17 |
| - base-url: /reactiveswift-composable-architecture/ |
18 |
| - format: html |
19 |
| - inputs: Sources/ComposableArchitecture |
20 |
| - module-name: ComposableArchitecture |
21 |
| - output: Documentation |
22 |
| - - name: Update Permissions |
23 |
| - run: 'sudo chown --recursive $USER Documentation' |
24 |
| - - name: Deploy to GitHub Pages |
25 |
| - uses: JamesIves/github-pages-deploy-action@releases/v3 |
| 27 | + key: swift-url-docc-build |
| 28 | + path: swift-docc/.build |
| 29 | + - name: Build swift-docc |
| 30 | + if: ${{ !steps.cache-docc.outputs.cache-hit }} |
| 31 | + run: | |
| 32 | + cd swift-docc; swift build --product docc -c release; cd .. |
| 33 | +
|
| 34 | + - name: Checkout swift-docc-render |
| 35 | + uses: actions/checkout@v2 |
| 36 | + with: |
| 37 | + repository: apple/swift-docc-render |
| 38 | + ref: main |
| 39 | + path: swift-docc-render |
| 40 | + - name: Build swift-docc-render |
| 41 | + run: | |
| 42 | + cd swift-docc-render; npm install && npm run build; cd .. |
| 43 | +
|
| 44 | + - name: Checkout gh-pages Branch |
| 45 | + uses: actions/checkout@v2 |
| 46 | + with: |
| 47 | + ref: gh-pages |
| 48 | + path: docs-out |
| 49 | + |
| 50 | + - name: Build documentation |
| 51 | + run: > |
| 52 | + rm -rf docs-out/.git; |
| 53 | + rm -rf docs-out/main; |
| 54 | + rm -rf docs-out/protocol; |
| 55 | +
|
| 56 | + for tag in $(echo "main"; echo "protocol"; git tag); |
| 57 | + do |
| 58 | + echo "⏳ Generating documentation for "$tag" release."; |
| 59 | +
|
| 60 | + if [ -d "docs-out/$tag" ] |
| 61 | + then |
| 62 | + echo "✅ Documentation for "$tag" already exists."; |
| 63 | + else |
| 64 | + git checkout .; |
| 65 | + git checkout "$tag"; |
| 66 | + mkdir -p Sources/ComposableArchitecture/Documentation.docc; |
| 67 | + export DOCC_HTML_DIR="$(pwd)/swift-docc-render/dist"; |
| 68 | +
|
| 69 | + rm -rf .build/symbol-graphs; |
| 70 | + mkdir -p .build/symbol-graphs; |
| 71 | + swift build \ |
| 72 | + --target ComposableArchitecture \ |
| 73 | + -Xswiftc \ |
| 74 | + -emit-symbol-graph \ |
| 75 | + -Xswiftc \ |
| 76 | + -emit-symbol-graph-dir \ |
| 77 | + -Xswiftc \ |
| 78 | + .build/symbol-graphs \ |
| 79 | + && swift-docc/.build/release/docc convert Sources/ComposableArchitecture/Documentation.docc \ |
| 80 | + --fallback-display-name ComposableArchitecture \ |
| 81 | + --fallback-bundle-identifier co.pointfree.ComposableArchitecture \ |
| 82 | + --fallback-bundle-version 0.0.0 \ |
| 83 | + --additional-symbol-graph-dir \ |
| 84 | + .build/symbol-graphs \ |
| 85 | + --transform-for-static-hosting \ |
| 86 | + --hosting-base-path /reactiveswift-composable-architecture/"$tag" \ |
| 87 | + --output-path docs-out/"$tag" \ |
| 88 | + && echo "✅ Documentation generated for "$tag" release." \ |
| 89 | + || echo "⚠️ Documentation skipped for "$tag"."; |
| 90 | + fi; |
| 91 | + done |
| 92 | +
|
| 93 | + - name: Fix permissions |
| 94 | + run: 'sudo chown -R $USER docs-out' |
| 95 | + - name: Publish documentation to GitHub Pages |
| 96 | + |
26 | 97 | with:
|
27 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
28 |
| - BRANCH: gh-pages |
29 |
| - FOLDER: Documentation |
| 98 | + branch: gh-pages |
| 99 | + folder: docs-out |
| 100 | + single-commit: true |
0 commit comments