Skip to content

Commit

Permalink
Fix build_docs gh action with some minor improvements
Browse files Browse the repository at this point in the history
Fix build_docs github action that was previously broken.
Some 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
- Use GITHUB_TOKEN instead of user credentials to push
- Use git user "action@github.com" to distinguish automated commits
- Check static files from doc branch into develop, so that we can modify
  them in a regular PR, rather than have to edit the doc branch
  directly.
    - This includes CNAME, index.html, .nojekyll

---
Signed-off-by: Ben Albrecht <ben-albrecht@users.noreply.github.com>
  • Loading branch information
Ben Albrecht committed Feb 10, 2022
1 parent ce90e70 commit d869b83
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 d869b83

Please sign in to comment.