Manually Rebuild All Docs and Create a PR with Docs Changes #13
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
name: Manually Rebuild All Docs and Create a PR with Docs Changes | |
on: | |
workflow_dispatch: | |
jobs: | |
build_docs: | |
name: Build and Deploy Documentation | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # to ensure other branches are available for build | |
- name: Install system dependencies | |
run: sudo apt-get install -y libhdf5-dev | |
- name: Set r compilation options | |
run: bash -c 'echo -e "MAKEFLAGS=--jobs=3\nCXXFLAGS += -O1 -UNDEBUG" > "$GITHUB_WORKSPACE/Makevars.user" && echo "R_MAKEVARS_USER=$GITHUB_WORKSPACE/Makevars.user" >> "$GITHUB_ENV"' | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Install R dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
cache-version: 1 | |
working-directory: 'r' | |
extra-packages: | | |
bioc::BSgenome.Hsapiens.UCSC.hg38 | |
github::GreenleafLab/motifmatchr | |
github::GreenleafLab/chromVARmotifs | |
needs: website | |
- name: Install BPCells | |
run: | | |
Rscript -e 'install.packages("r", repos=NULL, type="source")' | |
- name: Create git worktree with docs | |
run: | | |
git worktree add r/docs docs-html | |
- name: Build documentation | |
run: | | |
Rscript -e 'pkgdown::build_site_github_pages("r")' | |
- name: Configure Git | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Create new branch | |
run: | | |
git checkout -b update-docs-rebuild-$(git rev-parse --short=6 ${{ github.sha }}) | |
git add . | |
if git diff --cached --quiet; then echo "No changes to commit. Exiting."; exit 1; fi | |
git commit -m "Rebuild documentation for commit $(git rev-parse --short=6 ${{ github.sha }})" | |
working-directory: r/docs | |
- name: Push changes to new branch | |
run: git push origin update-docs-rebuild-$(git rev-parse --short=6 ${{ github.sha }}) | |
- name: Create Pull Request # use message with last commit | |
run: | | |
gh pr create --title "Rebuild docs for commit: $(git log -n 1 --pretty=%s)" --body "$(git log -n 1 main)" --base docs-html --head update-docs-rebuild-$(git rev-parse --short=6 ${{ github.sha }}) | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |