docs: add build step for autodoc

Add build step to generate autodocs and add github workflow for
publishing
This commit is contained in:
00JCIV00 2024-02-22 16:54:07 -05:00 committed by Tim Culverhouse
parent 9d87579076
commit 4069c83092
2 changed files with 48 additions and 0 deletions

38
.github/workflows/docs.yml vendored Normal file
View file

@ -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

View file

@ -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);
}