-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
David Freese
committed
Apr 19, 2021
1 parent
42a6740
commit eb8caca
Showing
11 changed files
with
49 additions
and
2,757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Generate Documenation Pages | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
generate: | ||
# if: ${{ github.repository_owner == 'bazelbuild' }} | ||
name: Generate Docs | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install bazelisk | ||
run: .github/workflows/scripts/install_bazelisk.sh | ||
env: | ||
USE_BAZEL_VERSION: 4.0.0 | ||
- name: Generate and Push | ||
run: .github/workflows/scripts/publish_docs.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.1.0/bazelisk-linux-amd64" | ||
mkdir -p "${GITHUB_WORKSPACE}/bin/" | ||
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel" | ||
chmod +x "${GITHUB_WORKSPACE}/bin/bazel" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
set -exuo pipefail | ||
|
||
# run within the docs workspace | ||
pushd docs &> /dev/null | ||
|
||
# We use a bazelisk-installed bazel | ||
"${GITHUB_WORKSPACE}/bin/bazel" clean | ||
"${GITHUB_WORKSPACE}/bin/bazel" build //... | ||
|
||
# Pull out the relevant docs | ||
cp bazel-bin/*.md . | ||
chmod 0644 *.md | ||
|
||
# And generate a new commit, that we push to the "docs" branch. | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
git add *.md | ||
git commit -m "Regenerate documentation" | ||
git remote -v | ||
git push -f origin HEAD:docs | ||
|
||
popd &> /dev/null | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.