Update docs and minor code visibility for consistency #19
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: "π | DocC | common-shell" | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: docc-pages-commonshell | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| container: swift:6.1-noble | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: π Generate DocC with swift-docc-plugin (multi-target) | |
| shell: bash | |
| env: | |
| BASE_PATH: ${{ github.event.repository.name }} | |
| MODULE_SLUG: commonshell | |
| run: | | |
| set -euo pipefail | |
| rm -rf "$GITHUB_WORKSPACE/_site" "$GITHUB_WORKSPACE/_site-main" "$GITHUB_WORKSPACE/_site-args" | |
| mkdir -p "$GITHUB_WORKSPACE/_site-main" "$GITHUB_WORKSPACE/_site-args" | |
| # 1) Main module | |
| swift package \ | |
| --allow-writing-to-directory "$GITHUB_WORKSPACE/_site-main" \ | |
| generate-documentation \ | |
| --target CommonShell \ | |
| --output-path "$GITHUB_WORKSPACE/_site-main" \ | |
| --transform-for-static-hosting \ | |
| --hosting-base-path "$BASE_PATH" | |
| # 2) Arguments module | |
| swift package \ | |
| --allow-writing-to-directory "$GITHUB_WORKSPACE/_site-args" \ | |
| generate-documentation \ | |
| --target CommonShellArguments \ | |
| --output-path "$GITHUB_WORKSPACE/_site-args" \ | |
| --transform-for-static-hosting \ | |
| --hosting-base-path "$BASE_PATH" | |
| # 3) Merge bundles into final _site | |
| rsync -a "$GITHUB_WORKSPACE/_site-main/" "$GITHUB_WORKSPACE/_site/" | |
| rsync -a "$GITHUB_WORKSPACE/_site-args/documentation/" "$GITHUB_WORKSPACE/_site/documentation/" | |
| rsync -a "$GITHUB_WORKSPACE/_site-args/data/documentation/" "$GITHUB_WORKSPACE/_site/data/documentation/" || true | |
| # 4) Friendly landing page linking both modules | |
| cat > "$GITHUB_WORKSPACE/_site/index.html" << EOF | |
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>CommonShell documentation</title> | |
| </head> | |
| <body> | |
| <h1>CommonShell β Documentation</h1> | |
| <ul> | |
| <li><a href="/$BASE_PATH/documentation/commonshell/">CommonShell</a></li> | |
| <li><a href="/$BASE_PATH/documentation/commonshellarguments/">CommonShellArguments</a></li> | |
| </ul> | |
| </body> | |
| </html> | |
| EOF | |
| # Optional org-site publish removed (no ORG_PAGES_TOKEN dependency) | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site | |
| deploy: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| needs: build | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |