From 4069c830920f8cc0227101b103af8a3a15b7aa11 Mon Sep 17 00:00:00 2001 From: 00JCIV00 Date: Thu, 22 Feb 2024 16:54:07 -0500 Subject: [PATCH] docs: add build step for autodoc Add build step to generate autodocs and add github workflow for publishing --- .github/workflows/docs.yml | 38 ++++++++++++++++++++++++++++++++++++++ build.zig | 10 ++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..1a16c78 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,38 @@ +name: docs + +on: + push: + branches: ["main"] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Pages + uses: actions/configure-pages@v2 + - uses: goto-bus-stop/setup-zig@v2 + with: + version: master + - run: zig build docs + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + path: "zig-out/docs" + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/build.zig b/build.zig index 7cee32e..426a5c5 100644 --- a/build.zig +++ b/build.zig @@ -60,4 +60,14 @@ pub fn build(b: *std.Build) void { lints_step.dependOn(&lints.step); b.default_step.dependOn(lints_step); + + // Docs + const vaxis_docs = tests; + const build_docs = b.addInstallDirectory(.{ + .source_dir = vaxis_docs.getEmittedDocs(), + .install_dir = .prefix, + .install_subdir = "docs", + }); + const build_docs_step = b.step("docs", "Build the vaxis library docs"); + build_docs_step.dependOn(&build_docs.step); }