Skip to content

Commit 2b368b8

Browse files
committed
automatically build api docs with github actions
1 parent f491e0d commit 2b368b8

File tree

4 files changed

+87
-10
lines changed

4 files changed

+87
-10
lines changed

.github/workflows/docs.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Test"
2+
on: push
3+
jobs:
4+
tests:
5+
runs-on: ubuntu-latest
6+
permissions: # Job-level permissions configuration starts here
7+
contents: write # 'write' access to repository contents
8+
steps:
9+
- uses: actions/checkout@v5
10+
- uses: cachix/install-nix-action@v31
11+
with:
12+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
13+
- run: nix run .#docs
14+
- name: Commit files
15+
run: |
16+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
17+
git config --local user.name "github-actions[bot]"
18+
git commit -a -m "automatically generate api docs"
19+
- name: Push changes
20+
uses: ad-m/github-push-action@master
21+
with:
22+
branch: docs

deps.edn

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
slipset/deps-deploy {:mvn/version "0.2.0"}}
2626
:ns-default build}
2727
:neil {:project {:name net.coruscation/js4clj}}
28-
:codox {:extra-deps {codox/codox {:mvn/version "0.10.8"}}
29-
:exec-fn codox.main/generate-docs
30-
:exec-args {:name "net.coruscation.js4clj"
31-
:description "Use JavaScript in JVM with Clojure by GraalJS"
32-
:namespaces [net.coruscation.js4clj.require
33-
net.coruscation.js4clj.core
34-
net.coruscation.js4clj.utils
35-
net.coruscation.js4clj.js
36-
net.coruscation.js4clj.api.polyglot]
37-
:output-path "docs"}}}}
28+
:docs {:extra-deps {codox/codox {:mvn/version "0.10.8"}}
29+
:exec-fn codox.main/generate-docs
30+
:exec-args {:name "net.coruscation.js4clj"
31+
:description "Use JavaScript in JVM with Clojure by GraalJS"
32+
:namespaces [net.coruscation.js4clj.require
33+
net.coruscation.js4clj.core
34+
net.coruscation.js4clj.utils
35+
net.coruscation.js4clj.js
36+
net.coruscation.js4clj.api.polyglot]
37+
:output-path "docs"}}}}

flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
3+
4+
outputs = { self, nixpkgs }:
5+
let
6+
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
7+
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
8+
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
9+
in
10+
{
11+
packages = forAllSystems (system:
12+
with pkgs.${system}; {
13+
docs = (writeShellScriptBin "docs"
14+
''${clojure}/bin/clj -X:docs
15+
echo "js4clj.coruscation.net" > docs/CNAME'');
16+
});
17+
18+
devShells = forAllSystems (system: let
19+
in {
20+
default = pkgs.${system}.mkShellNoCC {
21+
packages = with pkgs.${system}; [
22+
(mkPoetryEnv { projectDir = self; })
23+
poetry
24+
];
25+
};
26+
});
27+
};
28+
}

0 commit comments

Comments
 (0)