summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/docs.yml47
-rw-r--r--README.md6
-rw-r--r--build.zig8
3 files changed, 61 insertions, 0 deletions
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 0000000..defe4e2
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,47 @@
1name: API Reference
2
3on:
4 push:
5 branches: [master]
6
7 # Allow manually starting the workflow.
8 workflow_dispatch:
9
10# If two concurrent runs are started,
11# prefer the latest one.
12concurrency:
13 group: "pages"
14 cancel-in-progress: true
15
16jobs:
17
18 build:
19 name: Build website
20 runs-on: ubuntu-latest
21 steps:
22 - uses: actions/checkout@v4
23 - uses: goto-bus-stop/setup-zig@v2.0.1
24 with:
25 version: master
26 - name: Build
27 run: zig build docs
28 - name: Upload
29 uses: actions/upload-pages-artifact@v2
30 with:
31 path: "zig-out/docs/"
32
33 publish:
34 name: Publish website
35 runs-on: ubuntu-latest
36 needs: build # wait for build to finish
37 permissions:
38 # Request sufficient permissions to publish the website.
39 pages: write
40 id-token: write
41 steps:
42 - name: Deploy to GitHub Pages
43 id: deployment
44 uses: actions/deploy-pages@v3
45 environment:
46 name: github-pages
47 url: ${{ steps.deployment.outputs.page_url }}
diff --git a/README.md b/README.md
index f74c11f..d7ecda1 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,12 @@ in the release notes.
23* Print help message from parameter specification. 23* Print help message from parameter specification.
24* Parse help message to parameter specification. 24* Parse help message to parameter specification.
25 25
26## API Reference
27
28Automatically generated API Reference for the project
29can be found at https://Hejsil.github.io/zig-clap.
30Note that Zig autodoc is in beta; the website may be broken or incomplete.
31
26## Examples 32## Examples
27 33
28### `clap.parse` 34### `clap.parse`
diff --git a/build.zig b/build.zig
index bcf600e..ead9282 100644
--- a/build.zig
+++ b/build.zig
@@ -35,6 +35,14 @@ pub fn build(b: *std.Build) void {
35 example_step.dependOn(&install_example.step); 35 example_step.dependOn(&install_example.step);
36 } 36 }
37 37
38 const docs_step = b.step("docs", "Generate docs.");
39 const install_docs = b.addInstallDirectory(.{
40 .source_dir = tests.getEmittedDocs(),
41 .install_dir = .prefix,
42 .install_subdir = "docs",
43 });
44 docs_step.dependOn(&install_docs.step);
45
38 const readme_step = b.step("readme", "Remake README."); 46 const readme_step = b.step("readme", "Remake README.");
39 const readme = readMeStep(b); 47 const readme = readMeStep(b);
40 readme.dependOn(example_step); 48 readme.dependOn(example_step);