Skip to content

Commit

Permalink
Make rust doc deterministic (#878)
Browse files Browse the repository at this point in the history
Avoid committing if there is no change compared to the previous version,
to keep history clean.

Ref #246
  • Loading branch information
tiziano88 authored Apr 21, 2020
1 parent 37efedd commit e53981d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/build_rust_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,16 @@ jobs:
run: ./scripts/docker_run ./scripts/build_gh_pages ./out

# From the "out" folder, commit the results and push to gh-pages.
# This step only applies to `push` events (not `pull_request`).
# This step only applies to `push` events (not `pull_request`), and only if there are actual
# changes to commit in the "out" folder.
- name: Commit and push (post-merge only)
if: github.event_name == 'push'
run: |
cd ./out
git add .
git commit --message="Update gh-pages from ${GITHUB_SHA}"
git push
if [[ -n "$(git status --porcelain)" ]]; then
git commit --message="Update gh-pages from ${GITHUB_SHA}"
git push
else
echo 'no changes to commit'
fi
3 changes: 3 additions & 0 deletions scripts/build_gh_pages
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ cargo doc --no-deps --target-dir="${TARGET_DIR}"
# Remove non-doc artifacts from the target dir.
rm --recursive --force "${TARGET_DIR}/debug"

# Remove non-deterministic files.
rm "${TARGET_DIR}/.rustc_info.json"

# The docs generated from the Cargo workspace do not include a workspace-level index, so we generate
# one here and redirect to the Oak SDK documentation.
cat <<-END > "${TARGET_DIR}/index.html"
Expand Down

0 comments on commit e53981d

Please sign in to comment.