Skip to content

Commit 00208ea

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. There may be some permissions issues with the docs branch. In that case, I'm fine reverting this immediately afterwards. I've tested this to the extent I could on my forked repository.
1 parent ce29485 commit 00208ea

12 files changed

+49
-2765
lines changed

.bazelci/presubmit.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,6 @@ tasks:
7878
working_directory: examples
7979
test_targets:
8080
- //...
81-
docs_linux:
82-
name: Docs
83-
platform: ubuntu1804
84-
working_directory: docs
85-
build_targets:
86-
- //...
87-
run_targets:
88-
- "//:test_docs"
8981
clippy_examples:
9082
name: Clippy on Examples
9183
platform: ubuntu1804

.github/workflows/gen_docs.yaml

Lines changed: 18 additions & 0 deletions
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
Lines changed: 7 additions & 0 deletions
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"
Lines changed: 24 additions & 0 deletions
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

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)