Skip to content

Commit b7eae4e

Browse files
authored
chore: get bazel data as a submodule (#32)
This is the easiest way to just add a 'pointer' to get a read-only copy of their tree locally
1 parent 11420a7 commit b7eae4e

File tree

5 files changed

+53
-47
lines changed

5 files changed

+53
-47
lines changed

.github/workflows/codegen.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow is used to generate docs from the Bazel repo
2+
name: Generate docs from Bazel repo
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
workflow_dispatch:
8+
inputs:
9+
bazelCommitHash:
10+
description: 'The commit hash of the Bazel repo to use'
11+
type: string
12+
default: origin/main
13+
workflow_call:
14+
inputs:
15+
bazelCommitHash:
16+
description: 'The commit hash of the Bazel repo to use'
17+
type: string
18+
default: origin/main
19+
20+
jobs:
21+
codegen:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v5
25+
- name: Checkout submodules
26+
run: git submodule update --init -- upstream
27+
28+
- name: Checkout commit of BCR submodule
29+
working-directory: upstream
30+
run: git checkout ${{ inputs.bcrCommitHash }}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
on:
2+
repository_dispatch:
3+
types: [on-bazel-trigger]
4+
jobs:
5+
deploy:
6+
uses: ./.github/workflows/codegen.yml
7+
with:
8+
bcrCommitHash: ${{ github.event.client_payload.bcrCommitHash }}
9+
secrets: inherit

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "upstream"]
2+
path = upstream
3+
url = https://github.com/bazelbuild/bazel.git

README.md

Lines changed: 10 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,29 @@
11
# Bazel Docs
22

3-
Convert Bazel’s Devsite docs into a Hugo/Docsy site for easy modification.
3+
Host Bazel’s Devsite docs on a Mintlify site for easy modification.
44

55
## Motivation
66

77
This tool implements the improvements outlined in [Bazel Docs: Why It Might Be Time For A Refresh](https://alanmond.com/posts/bazel-documentation-improvements/). The goal is to create a more developer friendly set of Bazel Docs. Starting with [bazel.build/docs](https://bazel.build/docs)
88

99
## Live Demo
1010

11-
https\://bazel-docs-68tmf.ondigitalocean.app/
11+
https://bazel.online
1212

1313
## How it works
1414

15-
1. Clones the Devsite source from `bazel.build/docs`.
16-
2. Transforms Devsite frontmatter and directory layout into Hugo/Docsy format.
17-
3. Converts CSS/SCSS for Docsy theme compatibility.
15+
1. Clones the Devsite source from `bazel.build/docs` using a git submodule
16+
2. Transforms Devsite frontmatter and directory layout into MDX format.
17+
3. Hosted on Mintlify
1818

1919
## Usage
2020

21-
Bash into the docker image to see the Hugo converted website:
21+
Clone the submodule: `git submodule update --init -- upstream`
2222

23-
```bash
24-
docker run -it -p 1313:1313 alan707/bazel-docs:latest bash
25-
```
23+
Run the converter tool: TODO
2624

27-
Once inside, the generated Hugo site will be at the following location:
25+
Install the Mintlify dev tool: `npm install -g mint`
2826

29-
```bash
30-
root@7feab7b056d2:/app/docs# ls -al /app/docs
31-
total 52
32-
drwxr-xr-x 1 root root 4096 Jul 15 05:53 .
33-
drwxr-xr-x 1 root root 4096 Jul 15 05:53 ..
34-
-rw-r--r-- 1 root root 0 Jul 15 05:53 .hugo_build.lock
35-
drwxr-xr-x 2 root root 4096 Jul 15 05:53 archetypes
36-
drwxr-xr-x 3 root root 4096 Jul 15 05:53 assets
37-
drwxr-xr-x 25 root root 4096 Jul 15 05:53 content
38-
drwxr-xr-x 2 root root 4096 Jul 15 05:53 data
39-
-rw-r--r-- 1 root root 99 Jul 15 05:53 go.mod
40-
-rw-r--r-- 1 root root 394 Jul 15 05:53 go.sum
41-
-rw-r--r-- 1 root root 2527 Jul 15 05:53 hugo.yaml
42-
drwxr-xr-x 2 root root 4096 Jul 15 05:53 i18n
43-
drwxr-xr-x 2 root root 4096 Jul 15 05:53 layouts
44-
drwxr-xr-x 3 root root 4096 Jul 15 05:53 resources
45-
drwxr-xr-x 12 root root 4096 Jul 15 05:53 static
46-
```
27+
Then run `mint dev` to get a locally-running site.
4728

48-
To test your changes, you can convert the Bazel Docs Devsite into a Hugo website running this command
49-
```bash
50-
root@7feab7b056d2:/app# python /app/cli.py convert --source /app/work/bazel-source/site/en/ --output /app/docs/
51-
```
52-
53-
Add the modules needed (mainly Docsy)
54-
```bash
55-
cd /app/docs
56-
hugo mod init github.com/alan707/bazel-docs && \
57-
hugo mod get github.com/google/docsy@v0.12.0 && \
58-
hugo mod tidy
59-
```
60-
61-
Generate static files and start the Hugo server
62-
```bash
63-
cd /app/docs
64-
hugo --destination /workspace/public
65-
hugo server --bind 0.0.0.0 --baseURL "http://localhost:1313"
66-
```
29+
Send a PR to get a hosted preview of the changes.

upstream

Submodule upstream added at 906b91b

0 commit comments

Comments
 (0)