Skip to content

Commit 1e9d59e

Browse files
committed
Publish docs
1 parent 8b4f20f commit 1e9d59e

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed

.dagger/src/index.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from "@dagger.io/dagger";
1111

1212
const NODE_IMAGE = "node:24";
13+
const RUST_IMAGE = "rust:bookworm";
1314

1415
@object()
1516
export class AtomicServer {
@@ -103,6 +104,42 @@ export class AtomicServer {
103104
.stdout();
104105
}
105106

107+
@func()
108+
docsPublish(
109+
@argument({ defaultPath: "/docs" }) source: Directory,
110+
@argument() netlifyAuthToken: Secret
111+
): Promise<string> {
112+
return dag
113+
.container()
114+
.from(NODE_IMAGE)
115+
.withExec(["npm", "install", "-g", "netlify-cli"])
116+
.withSecretVariable("NETLIFY_AUTH_TOKEN", netlifyAuthToken)
117+
.withDirectory("/html", this.docsFolder(source.directory(".")))
118+
.withWorkdir("/html")
119+
.withExec([
120+
"sh",
121+
"-c",
122+
"netlify link --name atomic-docs --auth $NETLIFY_AUTH_TOKEN",
123+
])
124+
.withExec(["netlify", "deploy", "--dir", ".", "--prod"])
125+
.stdout();
126+
}
127+
128+
@func()
129+
docsFolder(@argument({ defaultPath: "/docs" }) source: Directory): Directory {
130+
const docsContainer = dag
131+
.container()
132+
.from(RUST_IMAGE)
133+
.withExec(["cargo", "install", "mdbook"])
134+
.withExec(["cargo", "install", "mdbook-linkcheck"]);
135+
// We skip installing mdbook-sitemap-generator because it's broken
136+
return docsContainer
137+
.withDirectory("/docs", source)
138+
.withWorkdir("/docs")
139+
.withExec(["mdbook", "build"])
140+
.directory("/docs/book/html");
141+
}
142+
106143
@func()
107144
typedocPublish(
108145
@argument({ defaultPath: "/browser" }) source: Directory,

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ Then you can run the commands from the `.dagger/src/index.ts` file, e.g. `dagger
6969
Add `-i` to the command to run in interactive mode, add `--output` to save the output to a folder.
7070
You can pass secrets / ENVS to dagger like so:
7171
`dagger call typedoc-publish --netlify-auth-token="env://NETLIFY_AUTH_TOKEN"`
72+
If Dagger is taking up a lot of storage, run `dagger core engine local-cache prune`.
7273
Note that the camelCase functions in the `index.ts` file are converted to kebab-case commands in the Dagger API.
73-
7474
Check out the [Dagger docs](https://docs.dagger.io/) for more information.
7575

7676
### Compilation using Earthly

docs/src/SUMMARY.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
- [Image](svelte/image.md)
3939
- [@tomic/template](create-template/atomic-template.md)
4040
- [@tomic/cli](js-cli.md)
41-
- [Rust](rust-lib.md)
42-
- [Rust lib](rust-lib.md)
43-
- [Rust CLI](rust-cli.md)
41+
- [Rust](rust.md)
42+
- [CLI](rust-cli.md)
43+
- [Lib](rust-lib.md)
4444

4545
# Guides
4646

docs/src/rust.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{#title Rust libraries & tools for Atomic Data}}
2+
# atomic-lib: Rust libraries & tools for Atomic Data
3+
4+
We have a [CLI] and a [library] for Rust.
5+
6+
[CLI]: rust-cli.md
7+
[library]: rust-lib.md

0 commit comments

Comments
 (0)