Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github action to generate and push docs to docs branch #695

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/gen_docs.yaml
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, seems Bazelisk is available on Ubuntu-2004 machines: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md

This step could probably be removed

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
7 changes: 7 additions & 0 deletions .github/workflows/scripts/install_bazelisk.sh
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"
24 changes: 24 additions & 0 deletions .github/workflows/scripts/publish_docs.sh
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

86 changes: 0 additions & 86 deletions docs/cargo_build_script.md

This file was deleted.

Loading