Skip to content

Commit c94ee92

Browse files
author
David Freese
committed
Add github action to generate and push docs to docs branch
Instead of requiring that users regenerate auto-generated documentation each time it changes, this adds a github action to force push any changes on the main branch to the docs branch. Github pages allows docs to be on any branch, in the docs folder.
1 parent ce29485 commit c94ee92

11 files changed

+49
-2757
lines changed

.github/workflows/gen_docs.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Generate Documenation Pages
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
generate:
8+
# if: ${{ github.repository_owner == 'bazelbuild' }}
9+
name: Generate Docs
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Install bazelisk
14+
run: .github/workflows/scripts/install_bazelisk.sh
15+
env:
16+
USE_BAZEL_VERSION: 4.0.0
17+
- name: Generate and Push
18+
run: .github/workflows/scripts/publish_docs.sh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.1.0/bazelisk-linux-amd64"
5+
mkdir -p "${GITHUB_WORKSPACE}/bin/"
6+
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
7+
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
set -exuo pipefail
3+
4+
# run within the docs workspace
5+
pushd docs &> /dev/null
6+
7+
# We use a bazelisk-installed bazel
8+
"${GITHUB_WORKSPACE}/bin/bazel" clean
9+
"${GITHUB_WORKSPACE}/bin/bazel" build //...
10+
11+
# Pull out the relevant docs
12+
cp bazel-bin/*.md .
13+
chmod 0644 *.md
14+
15+
# And generate a new commit, that we push to the "docs" branch.
16+
git config user.name github-actions
17+
git config user.email [email protected]
18+
git add *.md
19+
git commit -m "Regenerate documentation"
20+
git remote -v
21+
git push -f origin HEAD:docs
22+
23+
popd &> /dev/null
24+

docs/cargo_build_script.md

-86
This file was deleted.

0 commit comments

Comments
 (0)