Skip to content

Commit

Permalink
Fix build_docs gh action with some minor improvements (#143)
Browse files Browse the repository at this point in the history
Fix `build_docs` github action that was previously broken. Some other minor improvements were added as part of this fix.

Changes include:

- `build_docs` action is triggered when we push to develop branch
    - Previously, it was on PR closed, which isn't necessarily a merge, i.e. a contributor could close a PR without merging and the action would still trigger
- Use `GITHUB_TOKEN` instead of personal authentication (PA) credentials to push
- Use "action@github.com" as the git author (user) to distinguish automated commits from human commits
- Check static files from doc branch into develop, so that we can modify
  them in a regular PR to `develop`, rather than have to edit the doc branch
  directly. I'd like for us to get to a point where doc branch pushes are fully automated, so we should never have to modify it directly.
    - Static files include: `.nojekyll` (both top-level and per-sphinx-build), `CNAME`, and top-level `index.html`


[ Committed by @ben-albrecht ]
[ Reviewed by @Spartee ]
  • Loading branch information
ben-albrecht authored Feb 10, 2022
1 parent b66b077 commit be73de2
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 16 deletions.
Empty file added .docs_static/.nojekyll
Empty file.
1 change: 1 addition & 0 deletions .docs_static/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
www.craylabs.org
2 changes: 2 additions & 0 deletions .docs_static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

<meta http-equiv="refresh" content="0; url=./docs/overview.html" />
31 changes: 17 additions & 14 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: deploy_dev_docs

on:
pull_request:
types: [closed]
push:
branches:
- develop

jobs:
build_docs:
Expand All @@ -14,28 +15,30 @@ jobs:
with:
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.

- name: build documentation with docker
run: make docks

- uses: actions/checkout@v2
with:
ref: doc
path: doc-branch

- name: Move over release docs and stubs
- name: Copy over other doc versions from doc branch
run: |
rm -rf doc-branch/docs/develop/
mkdir -p ./docs
cp -r doc-branch/docs/* ./docs/
touch ./docs/.nojekyll
touch ./docs/develop/.nojekyll
rm -rf doc-branch
- name: Commit files and push
- name: build documentation with docker
run: make docks

- name: Commit files
run: |
git config --local user.email "spartee@hpe.com"
git config --local user.name "Sam Partee"
git checkout -b doc
git add .
git add -A
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -m "Update develop documentation"
git push --force --quiet "https://spartee:${{ secrets.DOC_PA_TOKEN }}@github.com/CrayLabs/SmartSim" doc:doc
- uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: doc
force: true
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ docs:
# help: docks - generate project documentation with docker
.PHONY: docks
docks:
@if [ -d "docs" ]; then rm -rf docs; fi
@rm -rf docs/develop
@mkdir -p docs
@docker compose build --progress=plain docs-dev
@docker create -ti --name devdocs smartsim-docs:dev-latest
@docker cp devdocs:/usr/local/src/SmartSim/doc/_build/html/ ./docs/develop/
@docker cp devdocs:/usr/local/src/SmartSim/doc/_build/html/ ./docs/develop
@docker container rm devdocs
@cp -r .docs_static/. ./docs/

# help: cov - generate html coverage report for Python client
.PHONY: cov
Expand Down
Empty file added doc/_static/.nojekyll
Empty file.

0 comments on commit be73de2

Please sign in to comment.