diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..e0a0b3d2 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,52 @@ +name: Nightly build and deploy + +on: + schedule: + - cron: '0 6 * * *' + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build-and-deploy: + if: github.repository == 'heckj/docs' + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + container: + image: swift:6.3 + steps: + - uses: actions/checkout@v7 + + - uses: actions/cache@v5 + with: + path: .workspace + key: docs-workspace-${{ hashFiles('scripts/sources.json') }} + restore-keys: | + docs-workspace- + + - name: Install Python + run: apt-get update && apt-get install -y python3 + + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Build documentation + run: python3 scripts/build_docs.py --output-dir "$GITHUB_WORKSPACE/build-output" --extra-hosting-prefix docs + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: 'build-output' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/scripts/README.md b/scripts/README.md index 4130cf9e..c767dda1 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -6,15 +6,20 @@ To build the combined documentation and view the result locally: ```bash set -e ./scripts/build_docs.py -python3 -m http.server 8000 --directory .build-output +python3 -m http.server 8123 --directory .build-output ``` Then in another terminal: ```bash -open http://localhost:8000/main/documentation/ +open http://localhost:8123/main/documentation/ ``` +Serve from `.build-output` (the parent), not `.build-output/main`: the build +bakes a `/main/` hosting base path into every asset URL, so the `/main/` prefix +must map to the `main/` directory. This example avoids port 8000, which can be +commonly used by other apps or examples. + ## Navigation manifest (combined sidebar curation) `navigation.json` controls the left-hand navigator of the **combined** archive diff --git a/scripts/navigation.json b/scripts/navigation.json index d9435516..6dadff89 100644 --- a/scripts/navigation.json +++ b/scripts/navigation.json @@ -2,33 +2,26 @@ "version": 1, "groups": [ { - "title": "Essential Libraries", + "title": "Swift", "modules": [ { "source": "swift-book", "path": "/documentation/the-swift-programming-language" }, - { "source": "swift-stdlib", "path": "/documentation/swift" }, - { "source": "swift-migration-guide", "path": "/documentation/migrationguide" }, { "source": "compiler-diagnostics", "path": "/documentation/diagnostics" }, - { "source": "swift-testing", "path": "/documentation/testing" } - ] + { "source": "swift-migration-guide", "path": "/documentation/migrationguide" } + ] }, { - "title": "Package Manager", - "modules": [ - { "source": "swiftpm", "path": "/documentation/packagemanagerdocs", "title": "Swift Package Manager" }, - { "source": "swiftpm", "path": "/documentation/packagedescription" }, - { "source": "swiftpm", "path": "/documentation/packageplugin" } - ] - }, - { - "title": "Server-Side Swift", + "title": "Essential Libraries", "modules": [ - { "source": "server-guides", "path": "/documentation/serverguides" }, - { "source": "swift-server-todos-tutorial", "path": "/tutorials/getting-started-swift-server" } + { "source": "swift-stdlib", "path": "/documentation/swift" }, + { "source": "swift-testing", "path": "/documentation/testing" } ] }, { "title": "Tools", "modules": [ + { "source": "swiftpm", "path": "/documentation/packagemanagerdocs", "title": "Swift Package Manager" }, + { "source": "swiftpm", "path": "/documentation/packagedescription" }, + { "source": "swiftpm", "path": "/documentation/packageplugin" }, { "source": "docc-documentation", "path": "/documentation/docc" }, { "source": "vscode-swift", "path": "/documentation/userdocs", "title": "Swift for VS Code" }, { "source": "swiftly", "path": "/documentation/swiftlydocs", "title": "Swiftly" } @@ -41,6 +34,13 @@ { "source": "swift-wasm", "path": "/documentation/wasmguide" }, { "source": "swift-android", "path": "/documentation/swiftandroid" } ] + }, + { + "title": "Server-Side Swift", + "modules": [ + { "source": "server-guides", "path": "/documentation/serverguides" }, + { "source": "swift-server-todos-tutorial", "path": "/tutorials/getting-started-swift-server" } + ] } ], "hidden": [ diff --git a/scripts/sources.json b/scripts/sources.json index d2a155a4..534fec94 100644 --- a/scripts/sources.json +++ b/scripts/sources.json @@ -59,7 +59,7 @@ "type": "git", "repo": "https://github.com/swiftlang/swift-embedded-examples.git", "ref": "main", - "docc_catalog": "Sources/EmbeddedSwift/EmbeddedSwift.docc" + "targets": ["EmbeddedSwift"] }, { "id": "swift-wasm",